sdk/js: fix account and instruction serialization

This commit is contained in:
A5 Pickle 2022-12-13 20:41:54 +00:00 committed by kev1n-peters
parent 1616df817e
commit b71181a404
3 changed files with 3 additions and 3 deletions

View File

@ -20,7 +20,7 @@ export function deriveClaimKey(
throw Error("address.length != 32");
}
const sequenceSerialized = Buffer.alloc(8);
sequenceSerialized.writeBigInt64BE(
sequenceSerialized.writeBigUInt64BE(
typeof sequence == "number" ? BigInt(sequence) : sequence
);
return deriveAddress(

View File

@ -65,7 +65,7 @@ function encodePostVaaData(account: PostVAAData): Buffer {
serialized.writeUInt32LE(account.nonce, 9);
serialized.writeUInt16LE(account.emitterChain, 13);
serialized.write(account.emitterAddress.toString("hex"), 15, "hex");
serialized.writeBigInt64LE(account.sequence, 47);
serialized.writeBigUInt64LE(account.sequence, 47);
serialized.writeUInt8(account.consistencyLevel, 55);
serialized.writeUInt32LE(payload.length, 56);
serialized.write(payload.toString("hex"), 60, "hex");

View File

@ -123,7 +123,7 @@ function encodePostVaa({
serialized.writeUInt32LE(nonce, 9);
serialized.writeUInt16LE(emitterChain, 13);
serialized.write(emitterAddress.toString("hex"), 15, "hex");
serialized.writeBigInt64LE(sequence, 47);
serialized.writeBigUInt64LE(sequence, 47);
serialized.writeUInt8(consistencyLevel, 55);
serialized.writeUInt32LE(payload.length, 56);
serialized.write(payload.toString("hex"), 60, "hex");