Skip to content

Commit 653b081

Browse files
committed
fix
1 parent b5e81f3 commit 653b081

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

lazer/sdk/js/src/ed25519.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ const PUBKEY_LEN = 32;
77
const MAGIC_LEN = 4;
88
const MESSAGE_SIZE_LEN = 2;
99

10-
const readUint16LE = (data: Uint8Array, offset: number) => {
11-
// @ts-expect-error - crashes if offset is out of bounds
12-
return data[offset] | (data[offset + 1] << 8);
13-
};
14-
1510
const ED25519_INSTRUCTION_LAYOUT = BufferLayout.struct<
1611
Readonly<{
1712
messageDataOffset: number;
@@ -37,7 +32,7 @@ const ED25519_INSTRUCTION_LAYOUT = BufferLayout.struct<
3732
]);
3833

3934
export const createEd25519Instruction = (
40-
message: Uint8Array,
35+
message: Buffer,
4136
instructionIndex: number,
4237
startingOffset: number
4338
) => {
@@ -46,8 +41,7 @@ export const createEd25519Instruction = (
4641
const messageDataSizeOffset = publicKeyOffset + PUBKEY_LEN;
4742
const messageDataOffset = messageDataSizeOffset + MESSAGE_SIZE_LEN;
4843

49-
const messageDataSize = readUint16LE(
50-
message,
44+
const messageDataSize = message.readUInt16LE(
5145
messageDataSizeOffset - startingOffset
5246
);
5347

0 commit comments

Comments
 (0)