Pre-release — The API surface may change. Unaudited.
Callcium LogoCallcium
API

Bytes

Byte and hex utilities.

Functions

toAddress

Validate and brand a hex string as an address. Throws if the runtime length is not exactly 20 bytes.

Git Source

function toAddress(hex: string): templateLiteral;

Parameters

NameTypeDescription
hexstring-

Returns

templateLiteral

hexToBytes

Convert a hex string to a byte array, stripping the 0x prefix if present.

Git Source

function hexToBytes(hex: string): Uint8Array;

Parameters

NameTypeDescription
hexstring-

Returns

Uint8Array

bytesToHex

Convert a byte array to a 0x-prefixed lowercase hex string.

Git Source

function bytesToHex(bytes: Uint8Array): templateLiteral;

Parameters

NameTypeDescription
bytesUint8Array-

Returns

templateLiteral

On this page