hexToCV

Converts a hex-encoded string to a Clarity value object. The inverse of cvToHex.


Usage

import { hexToCV } from '@stacks/transactions';

const cv = hexToCV('0x0100000000000000000000000000000064');
// UIntCV { type: 'uint', value: 100n }

// Also works without 0x prefix
const cv2 = hexToCV('0100000000000000000000000000000064');

Reference Linkarrow-up-right


Signature

function hexToCV(hex: string): ClarityValue;

Returns

ClarityValue

The deserialized Clarity value.


Parameters

hex (required)

  • Type: string

A hex-encoded string with or without 0x prefix.

Last updated

Was this helpful?