Skip to content

Commit

Permalink
Merge pull request #1 from jatZama/fix/remove-nonce-manager
Browse files Browse the repository at this point in the history
fix: removed nonce manager
  • Loading branch information
jatZama authored Feb 27, 2024
2 parents 1fbd253 + d9db45a commit 1a59e16
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 30 deletions.
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 11 additions & 26 deletions test/signers.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,12 @@
import { NonceManager } from "ethers";
import { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers";
import { ethers } from "hardhat";

// Module augmentation to add 'address' to NonceManager
declare module "ethers" {
interface NonceManager {
address: string;
}
}

// Extend the NonceManager prototype
Object.defineProperty(ethers.NonceManager.prototype, "address", {
get: function () {
return this.signer.address;
},
enumerable: true,
});

export interface Signers {
alice: NonceManager;
bob: NonceManager;
carol: NonceManager;
dave: NonceManager;
eve: NonceManager;
alice: HardhatEthersSigner;
bob: HardhatEthersSigner;
carol: HardhatEthersSigner;
dave: HardhatEthersSigner;
eve: HardhatEthersSigner;
}

let signers: Signers;
Expand All @@ -30,11 +15,11 @@ export const initSigners = async (): Promise<void> => {
if (!signers) {
const eSigners = await ethers.getSigners();
signers = {
alice: new NonceManager(eSigners[0]),
bob: new NonceManager(eSigners[1]),
carol: new NonceManager(eSigners[2]),
dave: new NonceManager(eSigners[3]),
eve: new NonceManager(eSigners[4]),
alice: eSigners[0],
bob: eSigners[1],
carol: eSigners[2],
dave: eSigners[3],
eve: eSigners[4],
};
}
};
Expand Down

0 comments on commit 1a59e16

Please sign in to comment.