MCPcopy
hub / github.com/eth-infinitism/account-abstraction / createAccount

Function createAccount

test/testutils.ts:292–317  ·  view source on GitHub ↗
(
  ethersSigner: Signer,
  accountOwner: string,
  entryPoint: string,
  _factory?: SimpleAccountFactory
)

Source from the content-addressed store, hash-verified

290
291// Deploys an implementation and a proxy pointing to this implementation
292export 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
319export function packAccountGasLimits (verificationGasLimit: BigNumberish, callGasLimit: BigNumberish): string {
320 return ethers.utils.hexConcat([

Calls 3

deployMethod · 0.80
connectMethod · 0.80
getAddressMethod · 0.80

Tested by

no test coverage detected