Skip to main content
Generates a deterministic HTLC preimage from a transfer ID using the wallet’s keys.

Method Signature

async getHTLCPreimage(transferID: string): Promise<Uint8Array>

Parameters

transferID
string
required
The transfer ID to generate a preimage for

Returns

preimage
Uint8Array
required
The 32-byte preimage

Example

const preimage = await wallet.getHTLCPreimage("transfer-id");
console.log("Preimage:", bytesToHex(preimage));