SimpleAccount.sol

A collection of scripts for managing contract accounts based on eth-infinitism's SimpleAccount.sol.

The SimpleAccount.sol is an sample contract that was audited and shipped along with the main ERC-4337 protocol. It was developed by the Ethereum Foundation and its simplicity makes it an excellent first step for developers that are just getting started with account abstraction.

For developers building production grade apps that require more flexibility, we recommend checking out ZeroDev Kernel.

For details on the supported SimpleAccount commands:

yarn run simpleAccount -h

🚧

Not using a paymaster?

Make sure to also have enough ETH or native gas tokens to pay for the transaction fees.

Get account address

SimpleAccount addresses can be deterministically generated. Use this command to get your account address based on the signingKey set in your config.json.

The account will be automatically deployed on the first transaction.

yarn run simpleAccount address

Transfer ETH

Before executing a transfer, make sure to deposit some ETH to the address generated by the simpleAccount address command.

yarn run simpleAccount transfer --to <address> --amount <eth>

Transfer ERC-20 token

Make sure the address generated by simpleAccount address has enough specified tokens to execute the transfer.

yarn run simpleAccount erc20Transfer --token <address> --to <address> --amount <decimal>

Approve ERC-20 token

This command allows you to run an ERC-20 approval transaction for your account. Its particularly useful for testing out an ERC-20 paymaster.

yarn run simpleAccount erc20Approve --token <address> --spender <address> --amount <decimal>

Batch transfer ERC-20 token

This command allows you to do multiple atomic contract interactions in a single transaction. The example shows us how with an ERC-20 token.

# recipient addresses is comma separated.
# e.g. 0x123..abc,0x456...def
yarn run simpleAccount batchErc20Transfer --token <address> --to <addresses> --amount <decimal>