From 2f1808059cc8451a5b2e86cd189a33dd1a9ebde3 Mon Sep 17 00:00:00 2001 From: petarTxFusion Date: Wed, 12 Feb 2025 16:41:25 +0100 Subject: [PATCH] fix(signer): fix `sendTransaction` populating from address --- src/signer.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/signer.ts b/src/signer.ts index bd38396..413f3cd 100644 --- a/src/signer.ts +++ b/src/signer.ts @@ -647,7 +647,15 @@ export class Signer extends AdapterL2(ethers.JsonRpcSigner) { override async sendTransaction( transaction: TransactionRequest ): Promise { + if (!transaction.type) { + transaction.type = EIP712_TX_TYPE; + } + const address = await this.getAddress(); + transaction.from ??= address; const tx = await this.populateFeeData(transaction); + if (!isAddressEq(await ethers.resolveAddress(tx.from!), address)) { + throw new Error('Transaction `from` address mismatch!'); + } if ( tx.type === null || @@ -655,11 +663,6 @@ export class Signer extends AdapterL2(ethers.JsonRpcSigner) { tx.type === EIP712_TX_TYPE || tx.customData ) { - const address = await this.getAddress(); - tx.from ??= address; - if (!isAddressEq(await ethers.resolveAddress(tx.from), address)) { - throw new Error('Transaction `from` address mismatch!'); - } const zkTx: TransactionLike = { type: tx.type ?? EIP712_TX_TYPE, value: tx.value ?? 0,