Skip to main content
Creates a receiver spend transaction for an HTLC using the preimage.

Method Signature

async createHTLCReceiverSpendTx({
  htlcTx,
  hash,
  hashLockDestinationPubkey,
  sequenceLockDestinationPubkey,
  preimage,
  satsPerVbyteFee,
}: {
  htlcTx: string;
  hash: string;
  hashLockDestinationPubkey: string;
  sequenceLockDestinationPubkey: string;
  preimage: string;
  satsPerVbyteFee: number;
}): Promise<string>

Parameters

htlcTx
string
required
The HTLC transaction hex
hash
string
required
The hash used in the HTLC
hashLockDestinationPubkey
string
required
Public key for the hash lock destination
sequenceLockDestinationPubkey
string
required
Public key for the sequence lock destination
preimage
string
required
The preimage to unlock the HTLC
satsPerVbyteFee
number
required
Fee rate in sats per vbyte

Returns

txHex
string
required
The signed receiver spend transaction hex

Example

const txHex = await wallet.createHTLCReceiverSpendTx({
  htlcTx: "02000000...",
  hash: "abc123...",
  hashLockDestinationPubkey: "02...",
  sequenceLockDestinationPubkey: "03...",
  preimage: "secret123...",
  satsPerVbyteFee: 10
});
console.log("Receiver spend tx:", txHex);