Skip to main content
Queries HTLCs with flexible filtering options.

Method Signature

async queryHTLC({
  paymentHashes,
  status,
  transferIds,
  matchRole,
  limit,
  offset,
}: {
  paymentHashes?: string[];
  status?: PreimageRequestStatus;
  transferIds?: string[];
  matchRole?: PreimageRequestRole;
  limit?: number;
  offset?: number;
}): Promise<QueryHtlcResponse>

Parameters

paymentHashes
string[]
Array of payment hashes to filter by
status
PreimageRequestStatus
Filter by HTLC status
transferIds
string[]
Array of transfer IDs to filter by
matchRole
PreimageRequestRole
Filter by role (default: PREIMAGE_REQUEST_ROLE_RECEIVER)
limit
number
Maximum results to return (1-100, default: 100). Values outside this range throw SparkValidationError.
offset
number
Pagination offset (default: 0). Must be non-negative.

Returns

response
QueryHtlcResponse
required
HTLC query results

Example

const htlcs = await wallet.queryHTLC({
  limit: 50,
  offset: 0
});
console.log("HTLCs:", htlcs);