UNPKG

lightningdevkit

Version:
94 lines 2.83 kB
import { CommonBase } from './CommonBase.mjs'; import * as bindings from '../bindings.mjs'; /** * Invalid inbound onion payment. */ export class InboundHTLCErr extends CommonBase { /* @internal */ constructor(_dummy, ptr) { super(ptr, bindings.InboundHTLCErr_free); } /** * BOLT 4 error code. */ get_err_code() { const ret = bindings.InboundHTLCErr_get_err_code(this.ptr); return ret; } /** * BOLT 4 error code. */ set_err_code(val) { bindings.InboundHTLCErr_set_err_code(this.ptr, val); } /** * Data attached to this error. * * Returns a copy of the field. */ get_err_data() { const ret = bindings.InboundHTLCErr_get_err_data(this.ptr); const ret_conv = bindings.decodeUint8Array(ret); return ret_conv; } /** * Data attached to this error. */ set_err_data(val) { bindings.InboundHTLCErr_set_err_data(this.ptr, bindings.encodeUint8Array(val)); } /** * Error message text. */ get_msg() { const ret = bindings.InboundHTLCErr_get_msg(this.ptr); const ret_conv = bindings.decodeString(ret); return ret_conv; } /** * Error message text. */ set_msg(val) { bindings.InboundHTLCErr_set_msg(this.ptr, bindings.encodeString(val)); } /** * Constructs a new InboundHTLCErr given each field */ static constructor_new(err_code_arg, err_data_arg, msg_arg) { const ret = bindings.InboundHTLCErr_new(err_code_arg, bindings.encodeUint8Array(err_data_arg), bindings.encodeString(msg_arg)); const ret_hu_conv = new InboundHTLCErr(null, ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); return ret_hu_conv; } clone_ptr() { const ret = bindings.InboundHTLCErr_clone_ptr(this.ptr); return ret; } /** * Creates a copy of the InboundHTLCErr */ clone() { const ret = bindings.InboundHTLCErr_clone(this.ptr); const ret_hu_conv = new InboundHTLCErr(null, ret); CommonBase.add_ref_from(ret_hu_conv, this); return ret_hu_conv; } /** * Generates a non-cryptographic 64-bit hash of the InboundHTLCErr. */ hash() { const ret = bindings.InboundHTLCErr_hash(this.ptr); return ret; } /** * Checks if two InboundHTLCErrs contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. * Two objects with NULL inner values will be considered "equal" here. */ eq(b) { const ret = bindings.InboundHTLCErr_eq(this.ptr, CommonBase.get_ptr_of(b)); CommonBase.add_ref_from(this, b); return ret; } } //# sourceMappingURL=InboundHTLCErr.mjs.map