isTxHash
Type predicate that returns true if a string is a valid Qubic transaction hash, narrowing its type to TxHash in the true branch.
Signature
isTxHash(s: string): s is TxHashPurpose
Returns true if s is exactly 60 lowercase characters. TypeScript narrows s to TxHash in the true branch. Works directly as a .filter() predicate — the inferred element type of the resulting array is TxHash.
import { isTxHash } from "@qubic.org/types"
const candidates: string[] = apiResponse.hashes
const validHashes = candidates.filter(isTxHash)
// validHashes: TxHash[] — TypeScript infers the narrowed element typeParameters
| Name | Type | Description |
|---|---|---|
s | string | String to check |
Returns
s is TxHash — a type predicate. true if s is exactly 60 lowercase characters, false otherwise.