UNPKG

lightningdevkit

Version:
163 lines 6.26 kB
import { BlindedHopFeatures } from '../structs/BlindedHopFeatures.mjs'; import { Result_BlindedPayInfoDecodeErrorZ } from '../structs/Result_BlindedPayInfoDecodeErrorZ.mjs'; import { CommonBase } from './CommonBase.mjs'; import * as bindings from '../bindings.mjs'; /** * Information needed to route a payment across a [`BlindedPaymentPath`]. */ export class BlindedPayInfo extends CommonBase { /* @internal */ constructor(_dummy, ptr) { super(ptr, bindings.BlindedPayInfo_free); } /** * Base fee charged (in millisatoshi) for the entire blinded path. */ get_fee_base_msat() { const ret = bindings.BlindedPayInfo_get_fee_base_msat(this.ptr); return ret; } /** * Base fee charged (in millisatoshi) for the entire blinded path. */ set_fee_base_msat(val) { bindings.BlindedPayInfo_set_fee_base_msat(this.ptr, val); } /** * Liquidity fee charged (in millionths of the amount transferred) for the entire blinded path * (i.e., 10,000 is 1%). */ get_fee_proportional_millionths() { const ret = bindings.BlindedPayInfo_get_fee_proportional_millionths(this.ptr); return ret; } /** * Liquidity fee charged (in millionths of the amount transferred) for the entire blinded path * (i.e., 10,000 is 1%). */ set_fee_proportional_millionths(val) { bindings.BlindedPayInfo_set_fee_proportional_millionths(this.ptr, val); } /** * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for the entire blinded * path. */ get_cltv_expiry_delta() { const ret = bindings.BlindedPayInfo_get_cltv_expiry_delta(this.ptr); return ret; } /** * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for the entire blinded * path. */ set_cltv_expiry_delta(val) { bindings.BlindedPayInfo_set_cltv_expiry_delta(this.ptr, val); } /** * The minimum HTLC value (in millisatoshi) that is acceptable to all channel peers on the * blinded path from the introduction node to the recipient, accounting for any fees, i.e., as * seen by the recipient. */ get_htlc_minimum_msat() { const ret = bindings.BlindedPayInfo_get_htlc_minimum_msat(this.ptr); return ret; } /** * The minimum HTLC value (in millisatoshi) that is acceptable to all channel peers on the * blinded path from the introduction node to the recipient, accounting for any fees, i.e., as * seen by the recipient. */ set_htlc_minimum_msat(val) { bindings.BlindedPayInfo_set_htlc_minimum_msat(this.ptr, val); } /** * The maximum HTLC value (in millisatoshi) that is acceptable to all channel peers on the * blinded path from the introduction node to the recipient, accounting for any fees, i.e., as * seen by the recipient. */ get_htlc_maximum_msat() { const ret = bindings.BlindedPayInfo_get_htlc_maximum_msat(this.ptr); return ret; } /** * The maximum HTLC value (in millisatoshi) that is acceptable to all channel peers on the * blinded path from the introduction node to the recipient, accounting for any fees, i.e., as * seen by the recipient. */ set_htlc_maximum_msat(val) { bindings.BlindedPayInfo_set_htlc_maximum_msat(this.ptr, val); } /** * Features set in `encrypted_data_tlv` for the `encrypted_recipient_data` TLV record in an * onion payload. */ get_features() { const ret = bindings.BlindedPayInfo_get_features(this.ptr); const ret_hu_conv = new BlindedHopFeatures(null, ret); CommonBase.add_ref_from(ret_hu_conv, this); return ret_hu_conv; } /** * Features set in `encrypted_data_tlv` for the `encrypted_recipient_data` TLV record in an * onion payload. */ set_features(val) { bindings.BlindedPayInfo_set_features(this.ptr, CommonBase.get_ptr_of(val)); } /** * Constructs a new BlindedPayInfo given each field */ static constructor_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg, features_arg) { const ret = bindings.BlindedPayInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg, CommonBase.get_ptr_of(features_arg)); const ret_hu_conv = new BlindedPayInfo(null, ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); return ret_hu_conv; } clone_ptr() { const ret = bindings.BlindedPayInfo_clone_ptr(this.ptr); return ret; } /** * Creates a copy of the BlindedPayInfo */ clone() { const ret = bindings.BlindedPayInfo_clone(this.ptr); const ret_hu_conv = new BlindedPayInfo(null, ret); CommonBase.add_ref_from(ret_hu_conv, this); return ret_hu_conv; } /** * Generates a non-cryptographic 64-bit hash of the BlindedPayInfo. */ hash() { const ret = bindings.BlindedPayInfo_hash(this.ptr); return ret; } /** * Checks if two BlindedPayInfos 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.BlindedPayInfo_eq(this.ptr, CommonBase.get_ptr_of(b)); CommonBase.add_ref_from(this, b); return ret; } /** * Serialize the BlindedPayInfo object into a byte array which can be read by BlindedPayInfo_read */ write() { const ret = bindings.BlindedPayInfo_write(this.ptr); const ret_conv = bindings.decodeUint8Array(ret); return ret_conv; } /** * Read a BlindedPayInfo from a byte array, created by BlindedPayInfo_write */ static constructor_read(ser) { const ret = bindings.BlindedPayInfo_read(bindings.encodeUint8Array(ser)); const ret_hu_conv = Result_BlindedPayInfoDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; } } //# sourceMappingURL=BlindedPayInfo.mjs.map