Account Abstraction (ERC-4337) bundlers and paymasters
Supercool can wrap an EOA and an ERC-4337 account abstraction (AA) wallet in order to provide gasless transactions through the AA wallet. ERC-4337 provides the greatest flexibility how transactions are mined on chain, supporting gasless txs, ERC-20 tokens as gas, and transaction bundling, among the other benefits of ERC-4337.
- let users transact gaslessly
- let users pay for transactions with ERC-20 coins
- bundle transactions together for gas savings
- pre-sign transactions to be executed later when certain conditions are met; for example, allow your users to create NFT limit orders
// Heads up: this NPM module is not published yet
import {supercool} from '@supercoolxyz/relayer-client'
import {ethers} from 'ethers'
// define these
const contractAddress = '0x...'
const abi = '{...}'
// replace this with whatever function creates your EOA signer
const eoaSigner = getEOASigner()
const provider = new supercool.ERC4337Provider({apiKey: ..., apiSecret: ...})
const signer = supercool.GaslessERC4337Signer.fromEOASigner(
provider,
eoaSigner,
// Get the smart contract wallet address for your given EOA.
// This is not a Supercool function, we're just showing a mocked
// example.
getERC4337WalletAddress(eoaSigner)
)
const contract = new ethers.Contract(contractAddress, abi, signer)
// Making smart contract calls with this `GaslessForwarderSigner` will
// create gasless meta-transactions for the underlying end-user.
await contract.buyToken(...)
Note that the
@supercoolxyz/relayer-client
package is not published yet, but you can reach out to us at [email protected] for early access.ERC-4337 wallets are capable of transaction bundling, gas sponsorship, and alternative gas payment methods. A user can interact with any dapp or protocol, regardless of whether that dapp is meta-transaction aware. Simply put, with ERC-4337 the end-user incurs a little extra setup cost, and then as a benefit can interact with the entire blockchain.
Traditional meta-transactions work with any type of wallet: EOAs, ERC-4337 wallets, and old-school smart contract wallets. The downside, is that dapps and protocols must be meta-tx aware.
In summary:
- ERC-4337:
- Pros: gasless transactions, bundling, etc. work with all other smart contracts
- Cons: extra setup cost and an extra wallet address to manage
- Traditional meta-txs:
- Pros: user can keep using their normal EOA (Privy wallet, Metamask, etc.)
- Cons: requires dapps and protocols to support meta-txs