UNPKG

lightningdevkit

Version:
66 lines 2.73 kB
import { CommonBase } from './CommonBase.mjs'; import * as bindings from '../bindings.mjs'; /** * An enum which can either contain a crate::lightning::ln::channel_state::ChannelShutdownState or not */ export class Option_ChannelShutdownStateZ extends CommonBase { constructor(_dummy, ptr) { super(ptr, bindings.COption_ChannelShutdownStateZ_free); } /* @internal */ static constr_from_ptr(ptr) { const raw_ty = bindings.LDKCOption_ChannelShutdownStateZ_ty_from_ptr(ptr); switch (raw_ty) { case 0: return new Option_ChannelShutdownStateZ_Some(ptr); case 1: return new Option_ChannelShutdownStateZ_None(ptr); default: throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface } } /** * Constructs a new COption_ChannelShutdownStateZ containing a crate::lightning::ln::channel_state::ChannelShutdownState */ static constructor_some(o) { const ret = bindings.COption_ChannelShutdownStateZ_some(o); const ret_hu_conv = Option_ChannelShutdownStateZ.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); return ret_hu_conv; } /** * Constructs a new COption_ChannelShutdownStateZ containing nothing */ static constructor_none() { const ret = bindings.COption_ChannelShutdownStateZ_none(); const ret_hu_conv = Option_ChannelShutdownStateZ.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); return ret_hu_conv; } clone_ptr() { const ret = bindings.COption_ChannelShutdownStateZ_clone_ptr(this.ptr); return ret; } /** * Creates a new COption_ChannelShutdownStateZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ clone() { const ret = bindings.COption_ChannelShutdownStateZ_clone(this.ptr); const ret_hu_conv = Option_ChannelShutdownStateZ.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, this); return ret_hu_conv; } } /** A Option_ChannelShutdownStateZ of type Some */ export class Option_ChannelShutdownStateZ_Some extends Option_ChannelShutdownStateZ { /* @internal */ constructor(ptr) { super(null, ptr); this.some = bindings.LDKCOption_ChannelShutdownStateZ_Some_get_some(ptr); } } /** A Option_ChannelShutdownStateZ of type None */ export class Option_ChannelShutdownStateZ_None extends Option_ChannelShutdownStateZ { /* @internal */ constructor(ptr) { super(null, ptr); } } //# sourceMappingURL=Option_ChannelShutdownStateZ.mjs.map