( ethersSigner: Signer, accountOwner: string, entryPoint: string, _factory?: SimpleAccountFactory )
| 290 | |
| 291 | // Deploys an implementation and a proxy pointing to this implementation |
| 292 | export async function createAccount ( |
| 293 | ethersSigner: Signer, |
| 294 | accountOwner: string, |
| 295 | entryPoint: string, |
| 296 | _factory?: SimpleAccountFactory |
| 297 | ): |
| 298 | Promise<{ |
| 299 | proxy: SimpleAccount |
| 300 | accountFactory: SimpleAccountFactory |
| 301 | implementation: string |
| 302 | }> { |
| 303 | const accountFactory = _factory ?? await new SimpleAccountFactory__factory(ethersSigner).deploy(entryPoint) |
| 304 | const implementation = await accountFactory.accountImplementation() |
| 305 | const entryPointContract = EntryPoint__factory.connect(entryPoint, ethersSigner) |
| 306 | const senderCreator = await entryPointContract.senderCreator() |
| 307 | await (ethersSigner.provider as JsonRpcProvider).send('hardhat_setBalance', [senderCreator, toHex(100e18)]) |
| 308 | const senderCreatorSigner = await ethers.getImpersonatedSigner(senderCreator) |
| 309 | await accountFactory.connect(senderCreatorSigner).createAccount(accountOwner, 0) |
| 310 | const accountAddress = await accountFactory.getAddress(accountOwner, 0) |
| 311 | const proxy = SimpleAccount__factory.connect(accountAddress, ethersSigner) |
| 312 | return { |
| 313 | implementation, |
| 314 | accountFactory, |
| 315 | proxy |
| 316 | } |
| 317 | } |
| 318 | |
| 319 | export function packAccountGasLimits (verificationGasLimit: BigNumberish, callGasLimit: BigNumberish): string { |
| 320 | return ethers.utils.hexConcat([ |
no test coverage detected