isHash
Checks if a string is a valid 32-byte hex hash.
Import
import { isHash } from 'viem'
Usage
import { isHash } from 'viem'
isHash('0xd9eba16ed0ecae432b71fe008c98cc872bb4cc214d3220a36f365326cf807d68')
// true
isHash('0xa5cc3c03994db5b0d9a5eEdD10Cabab0813678ac')
// false
Returns
boolean
Whether the string is a valid 32-byte hex hash.
Parameters
hash
The string to check.
- Type:
string