diff --git a/test/simple-wallet.test.ts b/test/simple-wallet.test.ts index f8c09663..91e6e371 100644 --- a/test/simple-wallet.test.ts +++ b/test/simple-wallet.test.ts @@ -1,6 +1,8 @@ import { Wallet } from 'ethers' import { ethers } from 'hardhat' import { expect } from 'chai' +import { toHex } from 'hardhat/internal/util/bigint' + import { ERC1967Proxy__factory, EntryPoint, @@ -166,9 +168,8 @@ describe('SimpleAccount', function () { // switch deployer contract to an impersonating signer const senderCreator = await entryPoint.senderCreator() - await (ethersSigner.provider as JsonRpcProvider).send('hardhat_impersonateAccount', [senderCreator]) - await (ethersSigner.provider as JsonRpcProvider).send('hardhat_setBalance', [senderCreator, parseEther('100').toHexString()]) - const senderCreatorSigner = await ethers.getSigner(senderCreator) + await (ethersSigner.provider as JsonRpcProvider).send('hardhat_setBalance', [senderCreator, toHex(100e18)]) + const senderCreatorSigner = await ethers.getImpersonatedSigner(senderCreator) deployer = deployer.connect(senderCreatorSigner) const target = await deployer.callStatic.createAccount(ownerAddr, 1234) diff --git a/test/testutils.ts b/test/testutils.ts index 40d44c5d..2a47f80b 100644 --- a/test/testutils.ts +++ b/test/testutils.ts @@ -1,4 +1,5 @@ import { ethers } from 'hardhat' +import { toHex } from 'hardhat/internal/util/bigint' import { arrayify, hexConcat, @@ -302,9 +303,8 @@ export async function createAccount ( const implementation = await accountFactory.accountImplementation() const entryPointContract = EntryPoint__factory.connect(entryPoint, ethersSigner) const senderCreator = await entryPointContract.senderCreator() - await (ethersSigner.provider as JsonRpcProvider).send('hardhat_impersonateAccount', [senderCreator]) - await (ethersSigner.provider as JsonRpcProvider).send('hardhat_setBalance', [senderCreator, parseEther('100').toHexString()]) - const senderCreatorSigner = await ethers.getSigner(senderCreator) + await (ethersSigner.provider as JsonRpcProvider).send('hardhat_setBalance', [senderCreator, toHex(100e18)]) + const senderCreatorSigner = await ethers.getImpersonatedSigner(senderCreator) await accountFactory.connect(senderCreatorSigner).createAccount(accountOwner, 0) const accountAddress = await accountFactory.getAddress(accountOwner, 0) const proxy = SimpleAccount__factory.connect(accountAddress, ethersSigner)