Skip to content

Commit

Permalink
Refactor serialisation params in getAwsKmsAccount and getGcpKmsAccount (
Browse files Browse the repository at this point in the history
#731)

* Refactor serialisation params in getAwsKmsAccount and getGcpKmsAccount

* better typees
  • Loading branch information
d4mr authored Oct 15, 2024
1 parent 3369ba8 commit 29fa697
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/server/utils/wallets/getAwsKmsAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,16 @@ export async function getAwsKmsAccount(

const r = `0x${signature.r.toString("hex")}` as Hex;
const s = `0x${signature.s.toString("hex")}` as Hex;
const v = signature.v;
const v = BigInt(signature.v);

const yParity = v % 2 === 0 ? 1 : (0 as 0 | 1);
const yParity: 0 | 1 = signature.v % 2 === 0 ? 1 : 0;

const signedTx = serializeTransaction({
transaction: tx,
signature: {
r,
s,
v,
yParity,
},
});
Expand Down
5 changes: 3 additions & 2 deletions src/server/utils/wallets/getGcpKmsAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,16 @@ export async function getGcpKmsAccount(

const r = signature.r.toString() as Hex;
const s = signature.s.toString() as Hex;
const v = signature.v;
const v = BigInt(signature.v);

const yParity = v % 2 === 0 ? 1 : (0 as 0 | 1);
const yParity: 0 | 1 = signature.v % 2 === 0 ? 1 : 0;

const signedTx = serializeTransaction({
transaction: tx,
signature: {
r,
s,
v,
yParity,
},
});
Expand Down

0 comments on commit 29fa697

Please sign in to comment.