This commit is contained in:
Danish Arora 2025-04-14 14:17:02 +05:30
parent e5a52d0a9c
commit 1cb62babe8
No known key found for this signature in database
GPG Key ID: 1C6EF37CDAE1426E

View File

@ -65,16 +65,8 @@ export function buildBigIntFromUint8Array(
array: Uint8Array,
byteOffset: number = 0
): bigint {
// Convert byte array to BigInt in big-endian format (to match nwaku)
let result = 0n;
// Process all 32 bytes (or the available bytes if less)
const length = Math.min(array.length - byteOffset, 32);
for (let i = 0; i < length; i++) {
result = (result << 8n) | BigInt(array[byteOffset + i]);
}
return result;
const dataView = new DataView(array.buffer);
return dataView.getBigUint64(byteOffset, true);
}
/**