Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.spark.money/llms.txt

Use this file to discover all available pages before exploring further.

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));