Skip to content

Commit 327691f

Browse files
authored
Reverse byte order when converting to/from hex strings (#161)
1 parent 7cdf885 commit 327691f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/sdk/src/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export function deepEqual(obj1: any, obj2: any): boolean {
4242

4343
export function uint8ArrayToHexString(array: Uint8Array): string {
4444
return Array.prototype.map
45-
.call(array, x => ('00' + x.toString(16)).slice(-2))
45+
.call(array.reverse(), x => ('00' + x.toString(16)).slice(-2))
4646
.join('');
4747
}
4848

@@ -69,7 +69,7 @@ export function hexStringToUint8Array(str: string): Uint8Array {
6969
if (data.length != 32) {
7070
return new Uint8Array(0);
7171
}
72-
return data;
72+
return data.reverse();
7373
}
7474

7575
export function hexStringToU128(str: string): bigint {

0 commit comments

Comments
 (0)