Skip to content

CompactSize.toHex

Encodes an integer using Bitcoin's CompactSize variable-length encoding and returns it as Hex.Hex.

Imports

Named
import { CompactSize } from 'ox'

Examples

import { CompactSize } from 'ox'
 
const hex = CompactSize.toHex(252)
// '0xfc'

Definition

function toHex(
  value: bigint | number,
): Hex.Hex

Source: src/core/CompactSize.ts

Parameters

value

  • Type: bigint | number

The integer to encode.

Return Type

The CompactSize-encoded hex string.

Hex.Hex