Skip to content

Commit d5168fc

Browse files
Xarozclaudedevin-ai-integration[bot]
authored
fix(utils): use readUInt8 for browser Buffer polyfill compat (#8578)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent eb7fa6e commit d5168fc

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

.changeset/fix-buffer-readuint8.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@hyperlane-xyz/utils': patch
3+
---
4+
5+
Fixed `parseMessage` crash in browser environments by using `readUInt8` instead of the Node.js 16+ `readUint8` alias, which is missing from common Buffer polyfills.

typescript/utils/src/messages.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export function parseMessage(message: string): ParsedMessage {
6565
const BODY_OFFSET = 77;
6666

6767
const buf = Buffer.from(utils.arrayify(message));
68-
const version = buf.readUint8(VERSION_OFFSET);
68+
const version = buf.readUInt8(VERSION_OFFSET);
6969
const nonce = buf.readUInt32BE(NONCE_OFFSET);
7070
const origin = buf.readUInt32BE(ORIGIN_OFFSET);
7171
const sender = utils.hexlify(buf.subarray(SENDER_OFFSET, DESTINATION_OFFSET));

0 commit comments

Comments
 (0)