Skip to content

Commit 151be1d

Browse files
committed
cleanup
1 parent c25898f commit 151be1d

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/bytes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ function toBytes(value: BytesLike): Bytes {
1414
}
1515
}
1616

17-
function toHex(value: BytesLike): string {
17+
function toHex(value: BytesLike): HexString {
1818
if (typeof value === 'string') {
1919
hexToBytes(value); // assert hex string
20-
return value;
20+
return value.replace(/^(0x)?/, '0x');
2121
} else if (value instanceof Uint8Array) {
2222
return '0x' + bytesToHex(value);
2323
} else {

src/core.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ export function isValidMerkleTree(tree: BytesLike[], nodeHash: NodeHash = standa
145145
return tree.length > 0;
146146
}
147147

148-
export function renderMerkleTree(tree: BytesLike[]): string {
148+
export function renderMerkleTree(tree: BytesLike[]): HexString {
149149
validateArgument(tree.length !== 0, 'Expected non-zero number of nodes');
150150

151151
const stack: [number, number[]][] = [[0, []]];

src/hashes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { encode } from '@metamask/abi-utils';
2-
import { keccak256 as _keccak256 } from 'ethereum-cryptography/keccak.js';
2+
import { keccak256 as _keccak256 } from 'ethereum-cryptography/keccak';
33
import { BytesLike, HexString, toHex, toBytes, concat, compare } from './bytes';
44

55
export type LeafHash<T> = (leaf: T) => HexString;

0 commit comments

Comments
 (0)