X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=ts%2Fstructs%2FWatch.ts;h=300d856ee11c0980b0da3250603b6ab69bde15ff;hb=f3e670e9341decac613d33fc52febf19cea32f20;hp=d2765e3d6b6c3f78e755cb769ead9746e5263c17;hpb=db1a11032b4164540a2d3403696be12bbca70e94;p=ldk-java diff --git a/ts/structs/Watch.ts b/ts/structs/Watch.ts index d2765e3d..300d856e 100644 --- a/ts/structs/Watch.ts +++ b/ts/structs/Watch.ts @@ -38,7 +38,7 @@ import * as bindings from '../bindings' // TODO: figure out location const monitor_hu_conv: ChannelMonitor = new ChannelMonitor(null, monitor); monitor_hu_conv.ptrs_to.add(this); Result_NoneChannelMonitorUpdateErrZ ret = arg.watch_channel(funding_txo_hu_conv, monitor_hu_conv); - result: number = ret != null ? ret.ptr : 0; + result: number = ret == null ? 0 : ret.clone_ptr(); return result; }, @@ -48,14 +48,13 @@ import * as bindings from '../bindings' // TODO: figure out location const update_hu_conv: ChannelMonitorUpdate = new ChannelMonitorUpdate(null, update); update_hu_conv.ptrs_to.add(this); Result_NoneChannelMonitorUpdateErrZ ret = arg.update_channel(funding_txo_hu_conv, update_hu_conv); - result: number = ret != null ? ret.ptr : 0; + result: number = ret == null ? 0 : ret.clone_ptr(); return result; }, release_pending_monitor_events (): number[] { MonitorEvent[] ret = arg.release_pending_monitor_events(); - result: number[] = ret != null ? Arrays.stream(ret).map(ret_conv_14 -> ret_conv_14.ptr).toArray(number[]::new) : null; - /* TODO 2 MonitorEvent */; + result: number[] = ret != null ? Arrays.stream(ret).map(ret_conv_14 -> ret_conv_14 == null ? 0 : ret_conv_14.clone_ptr()).toArray(number[]::new) : null; return result; }, @@ -78,16 +77,12 @@ import * as bindings from '../bindings' // TODO: figure out location public Result_NoneChannelMonitorUpdateErrZ watch_channel(OutPoint funding_txo, ChannelMonitor monitor) { number ret = bindings.Watch_watch_channel(this.ptr, funding_txo == null ? 0 : funding_txo.ptr & ~1, monitor == null ? 0 : monitor.ptr & ~1); Result_NoneChannelMonitorUpdateErrZ ret_hu_conv = Result_NoneChannelMonitorUpdateErrZ.constr_from_ptr(ret); - this.ptrs_to.add(funding_txo); - this.ptrs_to.add(monitor); return ret_hu_conv; } public Result_NoneChannelMonitorUpdateErrZ update_channel(OutPoint funding_txo, ChannelMonitorUpdate update) { number ret = bindings.Watch_update_channel(this.ptr, funding_txo == null ? 0 : funding_txo.ptr & ~1, update == null ? 0 : update.ptr & ~1); Result_NoneChannelMonitorUpdateErrZ ret_hu_conv = Result_NoneChannelMonitorUpdateErrZ.constr_from_ptr(ret); - this.ptrs_to.add(funding_txo); - this.ptrs_to.add(update); return ret_hu_conv; }