Skip to content

Commit

Permalink
fix: Ledger signature parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
michael1011 committed Nov 29, 2024
1 parent a5f46e3 commit 7a97e03
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/utils/hardware/LedgerSigner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,18 @@ class LedgerSigner implements EIP1193Provider, HardwareSigner {
v: number | string;
r: string;
s: string;
}) =>
Signature.from({
v: signature.v,
}) => {
const v =
typeof signature.v === "string" && !signature.v.startsWith("0x")
? BigInt(`0x${signature.v}`)
: signature.v;

return Signature.from({
v,
r: BigInt(`0x${signature.r}`).toString(),
s: BigInt(`0x${signature.s}`).toString(),
}).serialized;
};
}

export default LedgerSigner;

0 comments on commit 7a97e03

Please sign in to comment.