X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=ts%2Fstructs%2FMonitorEvent.ts;h=121b502547e2c3160a98474bea3baa5779da9d62;hb=c6bac88847b7c09560af81f00ba8dd3c2ebe3a19;hp=5fefa6b4f53a24f7c651ae23115ad5bce418cfe5;hpb=0d48e557e83ef085cc92c2de63b9c81c061ce78c;p=ldk-java diff --git a/ts/structs/MonitorEvent.ts b/ts/structs/MonitorEvent.ts index 5fefa6b4..121b5025 100644 --- a/ts/structs/MonitorEvent.ts +++ b/ts/structs/MonitorEvent.ts @@ -16,6 +16,12 @@ export default class MonitorEvent extends CommonBase { if (raw_val instanceof bindings.LDKMonitorEvent.CommitmentTxConfirmed) { return new CommitmentTxConfirmed(this.ptr, raw_val); } + if (raw_val instanceof bindings.LDKMonitorEvent.UpdateCompleted) { + return new UpdateCompleted(this.ptr, raw_val); + } + if (raw_val instanceof bindings.LDKMonitorEvent.UpdateFailed) { + return new UpdateFailed(this.ptr, raw_val); + } throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface } @@ -39,6 +45,28 @@ export class CommitmentTxConfirmed extends MonitorEvent { commitment_tx_confirmed_hu_conv.ptrs_to.add(this); this.commitment_tx_confirmed = commitment_tx_confirmed_hu_conv; } +} +export class UpdateCompleted extends MonitorEvent { + public funding_txo: OutPoint; + public monitor_update_id: number; + private constructor(ptr: number, obj: bindings.LDKMonitorEvent.UpdateCompleted) { + super(null, ptr); + const funding_txo: number = obj.funding_txo; + const funding_txo_hu_conv: OutPoint = new OutPoint(null, funding_txo); + funding_txo_hu_conv.ptrs_to.add(this); + this.funding_txo = funding_txo_hu_conv; + this.monitor_update_id = obj.monitor_update_id; + } +} +export class UpdateFailed extends MonitorEvent { + public update_failed: OutPoint; + private constructor(ptr: number, obj: bindings.LDKMonitorEvent.UpdateFailed) { + super(null, ptr); + const update_failed: number = obj.update_failed; + const update_failed_hu_conv: OutPoint = new OutPoint(null, update_failed); + update_failed_hu_conv.ptrs_to.add(this); + this.update_failed = update_failed_hu_conv; + } } public MonitorEvent clone() { number ret = bindings.MonitorEvent_clone(this.ptr); @@ -61,4 +89,23 @@ export class CommitmentTxConfirmed extends MonitorEvent { return ret_hu_conv; } + public static MonitorEvent constructor_update_completed(OutPoint funding_txo, number monitor_update_id) { + number ret = bindings.MonitorEvent_update_completed(funding_txo == null ? 0 : funding_txo.ptr & ~1, monitor_update_id); + MonitorEvent ret_hu_conv = MonitorEvent.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + public static MonitorEvent constructor_update_failed(OutPoint a) { + number ret = bindings.MonitorEvent_update_failed(a == null ? 0 : a.ptr & ~1); + MonitorEvent ret_hu_conv = MonitorEvent.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + public Uint8Array write() { + Uint8Array ret = bindings.MonitorEvent_write(this.ptr); + return ret; + } + }