From 3c0480493fb014c284ea63323d3b5261ad0ea5c9 Mon Sep 17 00:00:00 2001 From: danijelTxFusion Date: Tue, 23 Apr 2024 21:01:45 +0200 Subject: [PATCH] fix(signer): make `Signer` compatible when created using `Web3Provider.getSigner()` --- package.json | 2 +- src/signer.ts | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index d1690321..d9b167ec 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "zksync-ethers", - "version": "5.8.0-beta.4", + "version": "5.8.0-beta.5", "description": "A Web3 library for interacting with the ZkSync Layer 2 scaling solution.", "author": { "name": "Matter Labs", diff --git a/src/signer.ts b/src/signer.ts index cd04ea20..a979f0ea 100644 --- a/src/signer.ts +++ b/src/signer.ts @@ -178,7 +178,8 @@ export class Signer extends AdapterL2(ethers.providers.JsonRpcSigner) { } override _providerL2() { - return this.providerL2!; + // Make it compatible when singer is created with Web3Provider.getSigner() + return this.providerL2 ? this.providerL2 : this.provider; } /** @@ -345,7 +346,7 @@ export class Signer extends AdapterL2(ethers.providers.JsonRpcSigner) { * Provider.getDefaultProvider(types.Network.Sepolia) * ); * - * const tx = signer.transfer({ + * const tx = await signer.transfer({ * to: Wallet.createRandom().address, * amount: ethers.utils.parseEther("0.01"), * }); @@ -364,7 +365,7 @@ export class Signer extends AdapterL2(ethers.providers.JsonRpcSigner) { * Provider.getDefaultProvider(types.Network.Sepolia) * ); * - * const tx = signer.transfer({ + * const tx = await signer.transfer({ * to: Wallet.createRandom().address, * amount: ethers.utils.parseEther("0.01"), * paymasterParams: utils.getPaymasterParams(paymaster, {