Skip to content

arrayify

arrayify(value, options?): Uint8Array

Defined in: utils/bytes.ts:184

Converts DataHexStringOrArrayish to a Uint8Array Same as ethers.utils.arrayify

Parameters

value

the value to convert to a Uint8Array

number | bigint | BytesLike | Hexable

options?

DataOptions

options to use when converting the value to a Uint8Array

Returns

Uint8Array

the value represented as a Uint8Array

Examples

arrayify(1);
// Uint8Array(1) [ 1 ]
arrayify(0x1234);
// Uint8Array(2) [ 18, 52 ]
arrayify('0x1', { hexPad: 'right' });
// Uint8Array(1) [ 16 ]