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.
function toAddress(hex: string): templateLiteral;Parameters
| Name | Type | Description |
|---|---|---|
hex | string | - |
Returns
templateLiteral
hexToBytes
Convert a hex string to a byte array, stripping the 0x prefix if present.
function hexToBytes(hex: string): Uint8Array;Parameters
| Name | Type | Description |
|---|---|---|
hex | string | - |
Returns
Uint8Array
bytesToHex
Convert a byte array to a 0x-prefixed lowercase hex string.
function bytesToHex(bytes: Uint8Array): templateLiteral;Parameters
| Name | Type | Description |
|---|---|---|
bytes | Uint8Array | - |
Returns
templateLiteral