lightningdevkit
Version:
Lightning Development Kit
68 lines • 2.34 kB
JavaScript
import { Option_CVec_u8ZZ } from '../structs/Option_CVec_u8ZZ.mjs';
import { CommonBase } from './CommonBase.mjs';
import * as bindings from '../bindings.mjs';
/**
* The field in the [`InvoiceRequest`] or the [`Bolt12Invoice`] that contained an error.
*
* [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
* [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
*/
export class ErroneousField extends CommonBase {
/* @internal */
constructor(_dummy, ptr) {
super(ptr, bindings.ErroneousField_free);
}
/**
* The type number of the TLV field containing the error.
*/
get_tlv_fieldnum() {
const ret = bindings.ErroneousField_get_tlv_fieldnum(this.ptr);
return ret;
}
/**
* The type number of the TLV field containing the error.
*/
set_tlv_fieldnum(val) {
bindings.ErroneousField_set_tlv_fieldnum(this.ptr, val);
}
/**
* A value to use for the TLV field to avoid the error.
*
* Returns a copy of the field.
*/
get_suggested_value() {
const ret = bindings.ErroneousField_get_suggested_value(this.ptr);
const ret_hu_conv = Option_CVec_u8ZZ.constr_from_ptr(ret);
CommonBase.add_ref_from(ret_hu_conv, this);
return ret_hu_conv;
}
/**
* A value to use for the TLV field to avoid the error.
*/
set_suggested_value(val) {
bindings.ErroneousField_set_suggested_value(this.ptr, CommonBase.get_ptr_of(val));
}
/**
* Constructs a new ErroneousField given each field
*/
static constructor_new(tlv_fieldnum_arg, suggested_value_arg) {
const ret = bindings.ErroneousField_new(tlv_fieldnum_arg, CommonBase.get_ptr_of(suggested_value_arg));
const ret_hu_conv = new ErroneousField(null, ret);
CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
return ret_hu_conv;
}
clone_ptr() {
const ret = bindings.ErroneousField_clone_ptr(this.ptr);
return ret;
}
/**
* Creates a copy of the ErroneousField
*/
clone() {
const ret = bindings.ErroneousField_clone(this.ptr);
const ret_hu_conv = new ErroneousField(null, ret);
CommonBase.add_ref_from(ret_hu_conv, this);
return ret_hu_conv;
}
}
//# sourceMappingURL=ErroneousField.mjs.map