Skip to content

arrayify

arrayify(value, options?): Uint8Array

Defined in: utils/bytes.ts:184

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

number | bigint | BytesLike | Hexable

the value to convert to a Uint8Array

DataOptions

options to use when converting the value to a Uint8Array

Uint8Array

the value represented as a Uint8Array

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