@hyperlane-xyz/utils
Version:
General utilities and types for the Hyperlane network
20 lines • 753 B
TypeScript
import { BytesLike } from 'ethers';
/**
* Converts a 20-byte (or other length) ID to a 32-byte ID.
* Ensures that a bytes-like is 32 long. left-padding with 0s if not.
*
* @param data A string or array of bytes to canonize
* @returns A Uint8Array of length 32
*/
export declare function canonizeId(data: BytesLike): Uint8Array;
/**
* Converts a Hyperlane ID of 20 or 32 bytes to the corresponding EVM Address.
*
* For 32-byte IDs this enforces the EVM convention of using the LAST 20 bytes.
*
* @param data The data to truncate
* @returns A 20-byte, 0x-prepended hex string representing the EVM Address
* @throws if the data is not 20 or 32 bytes
*/
export declare function evmId(data: BytesLike): string;
//# sourceMappingURL=ids.d.ts.map