boolToHex
boolToHex(
value
,opts
?):Hex
Encodes a boolean into a hex string
Parameters
• value: boolean
Value to encode.
• opts?: BoolToHexOpts
Options.
Returns
Hex value.
Examples
import { boolToHex } from 'viem'const data = boolToHex(true)// '0x1'
import { boolToHex } from 'viem'const data = boolToHex(false)// '0x0'
import { boolToHex } from 'viem'const data = boolToHex(true, { size: 32 })// '0x0000000000000000000000000000000000000000000000000000000000000001'
Source
node_modules/.pnpm/viem@2.8.18_typescript@5.4.5_zod@3.23.8/node_modules/viem/_types/utils/encoding/toHex.d.ts:66