UNPKG

lightningdevkit

Version:
223 lines (222 loc) 7.49 kB
import { Result_NoneNoneZ } from '../structs/Result_NoneNoneZ.mjs'; import { Result_ChannelTypeFeaturesDecodeErrorZ } from '../structs/Result_ChannelTypeFeaturesDecodeErrorZ.mjs'; import { CommonBase } from './CommonBase.mjs'; /** * Features used within the channel_type field in an OpenChannel message. * * A channel is always of some known \"type\", describing the transaction formats used and the exact * semantics of our interaction with our peer. * * Note that because a channel is a specific type which is proposed by the opener and accepted by * the counterparty, only required features are allowed here. * * This is serialized differently from other feature types - it is not prefixed by a length, and * thus must only appear inside a TLV where its length is known in advance. */ export declare class ChannelTypeFeatures extends CommonBase { /** * Serialize the ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read */ write(): Uint8Array; /** * Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write */ static constructor_read(ser: Uint8Array): Result_ChannelTypeFeaturesDecodeErrorZ; /** * Checks if two ChannelTypeFeaturess 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: ChannelTypeFeatures): boolean; clone_ptr(): bigint; /** * Creates a copy of the ChannelTypeFeatures */ clone(): ChannelTypeFeatures; /** * Generates a non-cryptographic 64-bit hash of the ChannelTypeFeatures. */ hash(): bigint; /** * Constructs a ChannelTypeFeatures with only static_remotekey set */ static constructor_only_static_remote_key(): ChannelTypeFeatures; /** * Constructs a ChannelTypeFeatures with anchors support */ static constructor_anchors_zero_htlc_fee_and_dependencies(): ChannelTypeFeatures; /** * Create a blank Features with no features set */ static constructor_empty(): ChannelTypeFeatures; /** * Returns the feature set as a list of bytes, in little-endian. This is in reverse byte order * from most on-the-wire encodings. */ le_flags(): Uint8Array; /** * Returns true if this `Features` has any optional flags set */ supports_any_optional_bits(): boolean; /** * Returns true if this `Features` object contains required features unknown by `other`. */ requires_unknown_bits_from(other: ChannelTypeFeatures): boolean; /** * Returns the set of required features unknown by `other`, as their bit position. */ required_unknown_bits_from(other: ChannelTypeFeatures): BigUint64Array; /** * Returns true if this `Features` object contains unknown feature flags which are set as * \"required\". */ requires_unknown_bits(): boolean; /** * Returns true if this `Features` supports any bits which we do not know of */ supports_unknown_bits(): boolean; /** * Sets a required feature bit. Errors if `bit` is outside the feature range as defined * by [BOLT 9]. * * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will * be set instead (i.e., `bit - 1`). * * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md */ set_required_feature_bit(bit: number): Result_NoneNoneZ; /** * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined * by [BOLT 9]. * * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be * set instead (i.e., `bit + 1`). * * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md */ set_optional_feature_bit(bit: number): Result_NoneNoneZ; /** * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined * by [bLIP 2] or if it is a known `T` feature. * * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will * be set instead (i.e., `bit - 1`). * * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits */ set_required_custom_bit(bit: number): Result_NoneNoneZ; /** * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined * by [bLIP 2] or if it is a known `T` feature. * * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be * set instead (i.e., `bit + 1`). * * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits */ set_optional_custom_bit(bit: number): Result_NoneNoneZ; /** * Unsets the `scid_privacy` feature */ clear_scid_privacy(): void; /** * Unsets the `anchors_zero_fee_htlc_tx` feature */ clear_anchors_zero_fee_htlc_tx(): void; /** * Set this feature as optional. */ set_static_remote_key_optional(): void; /** * Set this feature as required. */ set_static_remote_key_required(): void; /** * Checks if this feature is supported. */ supports_static_remote_key(): boolean; /** * Checks if this feature is required. */ requires_static_remote_key(): boolean; /** * Set this feature as optional. */ set_anchors_nonzero_fee_htlc_tx_optional(): void; /** * Set this feature as required. */ set_anchors_nonzero_fee_htlc_tx_required(): void; /** * Checks if this feature is supported. */ supports_anchors_nonzero_fee_htlc_tx(): boolean; /** * Checks if this feature is required. */ requires_anchors_nonzero_fee_htlc_tx(): boolean; /** * Set this feature as optional. */ set_anchors_zero_fee_htlc_tx_optional(): void; /** * Set this feature as required. */ set_anchors_zero_fee_htlc_tx_required(): void; /** * Checks if this feature is supported. */ supports_anchors_zero_fee_htlc_tx(): boolean; /** * Checks if this feature is required. */ requires_anchors_zero_fee_htlc_tx(): boolean; /** * Set this feature as optional. */ set_taproot_optional(): void; /** * Set this feature as required. */ set_taproot_required(): void; /** * Checks if this feature is supported. */ supports_taproot(): boolean; /** * Checks if this feature is required. */ requires_taproot(): boolean; /** * Set this feature as optional. */ set_scid_privacy_optional(): void; /** * Set this feature as required. */ set_scid_privacy_required(): void; /** * Checks if this feature is supported. */ supports_scid_privacy(): boolean; /** * Checks if this feature is required. */ requires_scid_privacy(): boolean; /** * Set this feature as optional. */ set_zero_conf_optional(): void; /** * Set this feature as required. */ set_zero_conf_required(): void; /** * Checks if this feature is supported. */ supports_zero_conf(): boolean; /** * Checks if this feature is required. */ requires_zero_conf(): boolean; }