UNPKG

lightningdevkit

Version:
77 lines 3.19 kB
import { BlindedMessagePath } from '../structs/BlindedMessagePath.mjs'; import { CommonBase } from './CommonBase.mjs'; import * as bindings from '../bindings.mjs'; export class Result_CVec_BlindedMessagePathZNoneZ extends CommonBase { constructor(_dummy, ptr) { super(ptr, bindings.CResult_CVec_BlindedMessagePathZNoneZ_free); } /* @internal */ static constr_from_ptr(ptr) { if (bindings.CResult_CVec_BlindedMessagePathZNoneZ_is_ok(ptr)) { return new Result_CVec_BlindedMessagePathZNoneZ_OK(null, ptr); } else { return new Result_CVec_BlindedMessagePathZNoneZ_Err(null, ptr); } } /** * Creates a new CResult_CVec_BlindedMessagePathZNoneZ in the success state. */ static constructor_ok(o) { const ret = bindings.CResult_CVec_BlindedMessagePathZNoneZ_ok(bindings.encodeUint64Array(o.map(o_conv_20 => CommonBase.get_ptr_of(o_conv_20)))); const ret_hu_conv = Result_CVec_BlindedMessagePathZNoneZ.constr_from_ptr(ret); return ret_hu_conv; } /** * Creates a new CResult_CVec_BlindedMessagePathZNoneZ in the error state. */ static constructor_err() { const ret = bindings.CResult_CVec_BlindedMessagePathZNoneZ_err(); const ret_hu_conv = Result_CVec_BlindedMessagePathZNoneZ.constr_from_ptr(ret); return ret_hu_conv; } /** * Checks if the given object is currently in the success state */ is_ok() { const ret = bindings.CResult_CVec_BlindedMessagePathZNoneZ_is_ok(this.ptr); return ret; } clone_ptr() { const ret = bindings.CResult_CVec_BlindedMessagePathZNoneZ_clone_ptr(this.ptr); return ret; } /** * Creates a new CResult_CVec_BlindedMessagePathZNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ clone() { const ret = bindings.CResult_CVec_BlindedMessagePathZNoneZ_clone(this.ptr); const ret_hu_conv = Result_CVec_BlindedMessagePathZNoneZ.constr_from_ptr(ret); return ret_hu_conv; } } export class Result_CVec_BlindedMessagePathZNoneZ_OK extends Result_CVec_BlindedMessagePathZNoneZ { /* @internal */ constructor(_dummy, ptr) { super(_dummy, ptr); const res = bindings.CResult_CVec_BlindedMessagePathZNoneZ_get_ok(ptr); const res_conv_20_len = bindings.getArrayLength(res); const res_conv_20_arr = new Array(res_conv_20_len).fill(null); for (var u = 0; u < res_conv_20_len; u++) { const res_conv_20 = bindings.getU64ArrayElem(res, u); const res_conv_20_hu_conv = new BlindedMessagePath(null, res_conv_20); CommonBase.add_ref_from(res_conv_20_hu_conv, this); res_conv_20_arr[u] = res_conv_20_hu_conv; } bindings.freeWasmMemory(res); this.res = res_conv_20_arr; } } export class Result_CVec_BlindedMessagePathZNoneZ_Err extends Result_CVec_BlindedMessagePathZNoneZ { /* @internal */ constructor(_dummy, ptr) { super(_dummy, ptr); } } //# sourceMappingURL=Result_CVec_BlindedMessagePathZNoneZ.mjs.map