From 0bdbe6748d086a9cc05cd7aa887017f51091ced0 Mon Sep 17 00:00:00 2001 From: michael1011 Date: Fri, 29 Nov 2024 13:09:22 +0100 Subject: [PATCH] fix: Ledger signature parsing (#756) --- src/utils/hardware/LedgerSigner.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/utils/hardware/LedgerSigner.ts b/src/utils/hardware/LedgerSigner.ts index 376ca5a7..f6a91416 100644 --- a/src/utils/hardware/LedgerSigner.ts +++ b/src/utils/hardware/LedgerSigner.ts @@ -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;