UNPKG

lightningdevkit

Version:
131 lines 5.23 kB
import { BlindedHopFeatures } from '../structs/BlindedHopFeatures.mjs'; import { PaymentRelay } from '../structs/PaymentRelay.mjs'; import { PaymentConstraints } from '../structs/PaymentConstraints.mjs'; import { CommonBase } from './CommonBase.mjs'; import * as bindings from '../bindings.mjs'; /** * Data to construct a [`BlindedHop`] for forwarding a payment. */ export class ForwardTlvs extends CommonBase { /* @internal */ constructor(_dummy, ptr) { super(ptr, bindings.ForwardTlvs_free); } /** * The short channel id this payment should be forwarded out over. */ get_short_channel_id() { const ret = bindings.ForwardTlvs_get_short_channel_id(this.ptr); return ret; } /** * The short channel id this payment should be forwarded out over. */ set_short_channel_id(val) { bindings.ForwardTlvs_set_short_channel_id(this.ptr, val); } /** * Payment parameters for relaying over [`Self::short_channel_id`]. */ get_payment_relay() { const ret = bindings.ForwardTlvs_get_payment_relay(this.ptr); const ret_hu_conv = new PaymentRelay(null, ret); CommonBase.add_ref_from(ret_hu_conv, this); return ret_hu_conv; } /** * Payment parameters for relaying over [`Self::short_channel_id`]. */ set_payment_relay(val) { bindings.ForwardTlvs_set_payment_relay(this.ptr, CommonBase.get_ptr_of(val)); } /** * Payment constraints for relaying over [`Self::short_channel_id`]. */ get_payment_constraints() { const ret = bindings.ForwardTlvs_get_payment_constraints(this.ptr); const ret_hu_conv = new PaymentConstraints(null, ret); CommonBase.add_ref_from(ret_hu_conv, this); return ret_hu_conv; } /** * Payment constraints for relaying over [`Self::short_channel_id`]. */ set_payment_constraints(val) { bindings.ForwardTlvs_set_payment_constraints(this.ptr, CommonBase.get_ptr_of(val)); } /** * Supported and required features when relaying a payment onion containing this object's * corresponding [`BlindedHop::encrypted_payload`]. * * [`BlindedHop::encrypted_payload`]: crate::blinded_path::BlindedHop::encrypted_payload */ get_features() { const ret = bindings.ForwardTlvs_get_features(this.ptr); const ret_hu_conv = new BlindedHopFeatures(null, ret); CommonBase.add_ref_from(ret_hu_conv, this); return ret_hu_conv; } /** * Supported and required features when relaying a payment onion containing this object's * corresponding [`BlindedHop::encrypted_payload`]. * * [`BlindedHop::encrypted_payload`]: crate::blinded_path::BlindedHop::encrypted_payload */ set_features(val) { bindings.ForwardTlvs_set_features(this.ptr, CommonBase.get_ptr_of(val)); } /** * Set if this [`BlindedPaymentPath`] is concatenated to another, to indicate the * [`BlindedPaymentPath::blinding_point`] of the appended blinded path. * * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ get_next_blinding_override() { const ret = bindings.ForwardTlvs_get_next_blinding_override(this.ptr); const ret_conv = bindings.decodeUint8Array(ret); return ret_conv; } /** * Set if this [`BlindedPaymentPath`] is concatenated to another, to indicate the * [`BlindedPaymentPath::blinding_point`] of the appended blinded path. * * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ set_next_blinding_override(val) { bindings.ForwardTlvs_set_next_blinding_override(this.ptr, bindings.encodeUint8Array(val)); } /** * Constructs a new ForwardTlvs given each field * * Note that next_blinding_override_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ static constructor_new(short_channel_id_arg, payment_relay_arg, payment_constraints_arg, features_arg, next_blinding_override_arg) { const ret = bindings.ForwardTlvs_new(short_channel_id_arg, CommonBase.get_ptr_of(payment_relay_arg), CommonBase.get_ptr_of(payment_constraints_arg), CommonBase.get_ptr_of(features_arg), bindings.encodeUint8Array(next_blinding_override_arg)); const ret_hu_conv = new ForwardTlvs(null, ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); return ret_hu_conv; } clone_ptr() { const ret = bindings.ForwardTlvs_clone_ptr(this.ptr); return ret; } /** * Creates a copy of the ForwardTlvs */ clone() { const ret = bindings.ForwardTlvs_clone(this.ptr); const ret_hu_conv = new ForwardTlvs(null, ret); CommonBase.add_ref_from(ret_hu_conv, this); return ret_hu_conv; } /** * Serialize the ForwardTlvs object into a byte array which can be read by ForwardTlvs_read */ write() { const ret = bindings.ForwardTlvs_write(this.ptr); const ret_conv = bindings.decodeUint8Array(ret); return ret_conv; } } //# sourceMappingURL=ForwardTlvs.mjs.map