Skip to content

Commit

Permalink
fix(signer): make Signer compatible when created using `BrowserProv…
Browse files Browse the repository at this point in the history
…ider.getSigner()`
  • Loading branch information
danijelTxFusion committed May 9, 2024
1 parent d125eea commit e62c98d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/signer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ export class Signer extends AdapterL2(ethers.JsonRpcSigner) {
}

override _providerL2() {
return this.providerL2!;
// Make it compatible when singer is created with Web3Provider.getSigner()
return this.providerL2 ? this.providerL2 : this.provider;
}

/**
Expand Down Expand Up @@ -355,7 +356,7 @@ export class Signer extends AdapterL2(ethers.JsonRpcSigner) {
* Provider.getDefaultProvider(types.Network.Sepolia)
* );
*
* const tx = signer.transfer({
* const tx = await signer.transfer({
* to: Wallet.createRandom().address,
* amount: ethers.parseEther("0.01"),
* });
Expand All @@ -373,7 +374,7 @@ export class Signer extends AdapterL2(ethers.JsonRpcSigner) {
* const paymaster = "0x13D0D8550769f59aa241a41897D4859c87f7Dd46"; // Paymaster for Crown token
*
* const browserProvider = new BrowserProvider(window.ethereum);
* const signer = Signer.from(
* const signer = await Signer.from(
* await browserProvider.getSigner(),
* Number((await browserProvider.getNetwork()).chainId),
* Provider.getDefaultProvider(types.Network.Sepolia)
Expand Down

0 comments on commit e62c98d

Please sign in to comment.