diff --git a/src/hex.ts b/src/hex.ts index 66dd6da6e..46bdbf648 100644 --- a/src/hex.ts +++ b/src/hex.ts @@ -87,7 +87,7 @@ export function isValidHexAddress(possibleAddress: Hex) { * @returns The address encoded according to ERC-55. * @see https://eips.ethereum.org/EIPS/eip-55 */ -export function getChecksumAddress(address: Hex) { +export function getChecksumAddress(address: Hex): Hex { assert(is(address, HexChecksumAddressStruct), 'Invalid hex address.'); const unPrefixed = remove0x(address.toLowerCase()); const unPrefixedHash = remove0x(bytesToHex(keccak256(unPrefixed))); diff --git a/src/number.ts b/src/number.ts index c485e1053..70e4ae935 100644 --- a/src/number.ts +++ b/src/number.ts @@ -1,4 +1,5 @@ import { assert } from './assert'; +import type { Hex } from './hex'; import { add0x, assertIsHexString } from './hex'; /** @@ -18,7 +19,7 @@ import { add0x, assertIsHexString } from './hex'; * @returns The hexadecimal string, with the "0x"-prefix. * @throws If the number is not a non-negative safe integer. */ -export const numberToHex = (value: number): string => { +export const numberToHex = (value: number): Hex => { assert(typeof value === 'number', 'Value must be a number.'); assert(value >= 0, 'Value must be a non-negative number.'); assert( @@ -45,7 +46,7 @@ export const numberToHex = (value: number): string => { * @returns The hexadecimal string, with the "0x"-prefix. * @throws If the `bigint` is not a non-negative integer. */ -export const bigIntToHex = (value: bigint): string => { +export const bigIntToHex = (value: bigint): Hex => { assert(typeof value === 'bigint', 'Value must be a bigint.'); assert(value >= 0, 'Value must be a non-negative bigint.');