diff --git a/src/chains/ethereum/ethereum/src/api.ts b/src/chains/ethereum/ethereum/src/api.ts index 58ae4cda06..61a1c3ce0a 100644 --- a/src/chains/ethereum/ethereum/src/api.ts +++ b/src/chains/ethereum/ethereum/src/api.ts @@ -1821,10 +1821,9 @@ export default class EthereumApi implements Api { throw new Error("cannot sign data; no private key"); } - const chainId = this.#options.chain.chainId; const messageHash = hashPersonalMessage(Data.from(message).toBuffer()); - const { v, r, s } = ecsign(messageHash, privateKey.toBuffer(), chainId); - return toRpcSig(v, r, s, chainId); + const { v, r, s } = ecsign(messageHash, privateKey.toBuffer()); + return toRpcSig(v, r, s); } /** diff --git a/src/chains/ethereum/ethereum/tests/api/eth/sign.test.ts b/src/chains/ethereum/ethereum/tests/api/eth/sign.test.ts index be8db14351..10240b8739 100644 --- a/src/chains/ethereum/ethereum/tests/api/eth/sign.test.ts +++ b/src/chains/ethereum/ethereum/tests/api/eth/sign.test.ts @@ -45,13 +45,7 @@ describe("api", () => { const r = Buffer.from(sgn.slice(0, 64), "hex"); const s = Buffer.from(sgn.slice(64, 128), "hex"); const v = parseInt(sgn.slice(128), 16); - const pub = ecrecover( - msgHash, - v, - r, - s, - provider.getOptions().chain.chainId - ); + const pub = ecrecover(msgHash, v, r, s); const addr = fromSigned(pubToAddress(pub)); const strAddr = "0x" + addr.toString("hex"); assert.strictEqual(strAddr, accounts[0].toLowerCase()); @@ -71,13 +65,7 @@ describe("api", () => { const r = Buffer.from(sgn.slice(0, 64), "hex"); const s = Buffer.from(sgn.slice(64, 128), "hex"); const v = parseInt(sgn.slice(128), 16); - const pub = ecrecover( - msgHash, - v, - r, - s, - provider.getOptions().chain.chainId - ); + const pub = ecrecover(msgHash, v, r, s); const addr = fromSigned(pubToAddress(pub)); const strAddr = "0x" + addr.toString("hex"); assert.deepStrictEqual(strAddr, accounts[0].toLowerCase());