UNPKG

@node-dlc/core

Version:
46 lines 1.95 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Htlc = void 0; /** * An HTLC (hashed time-locked contract) is part of the transfer * layer of the Lightning network. HTLCs are used to trustlessly offer * a payment to a counterparty if they are able to provide a preimage * of the hash. The offeror can claw back funds after an expiration * period (absolute lock time) if the recipient is unable to provide * the preimage for the contract. HTLCs are used in Lightning for both * initiating payments to a peer directly and as part of forwarding * payments. */ class Htlc { /** * Constructs an HTLC with associated information * @param htlcId Identifier for the HTLC is a counter maintained * per-channel, per-peer. It starts at zero and is incremented when * an HTLC is offered. This value is used when sending channel * related messages to disambiguate HTLCs that may share the same * preimage. * * @param direction Direction, from your node's perspective, that * indicates if the HTLC was offered or received. * * @param value The value of the HTLC in millisatoshi. * * @param cltvExpiry The absolutely blocktime expiry of the HTLC. * The value must be under 500,000,000 to ensure it is a block-based * locktime. After this timeout has expired, the offeror can perform * a forced resolution on-chain. * * @param paymentHash The 32-byte hash of the preimage. Knowledge of * the preimage is irrevocable and considers payment complete. */ constructor(htlcId, direction, value, cltvExpiry, paymentHash, paymentPreimage) { this.htlcId = htlcId; this.direction = direction; this.value = value; this.cltvExpiry = cltvExpiry; this.paymentHash = paymentHash; this.paymentPreimage = paymentPreimage; } } exports.Htlc = Htlc; //# sourceMappingURL=Htlc.js.map