Custom Integration
If you have an existing custom signer or another third-party embedded wallet provider, you can upgrade your embedded EOAs to smart wallets by connecting your existing signer. This will allow you to use EIP-7702 to get features like gas sponsorship, batching, and more.
Requirement: Your signer or embedded wallet provider must support signing EIP-7702 authorizations in order to delegate to a smart account.
To bring your own signer, you create a SmartAccountSigner that implements signAuthorization. See the details for the interface requirements here.
JavaScript
For example, you can upgrade an existing embedded EOA by extending a viem WalletClient to use your provider’s EIP-7702 authorization signing.
The bulk of the logic happens in a function that returns a client. Your embedded wallet is wrapped in a WalletClientSigner that supports signAuthorization, then passed to createSmartWalletClient to construct a client for sending transactions.
Steps:
- Wrap your embedded wallet with
WalletClientSignerthat implementssignAuthorization. - Create a
SmartWalletClientwith your signer and Alchemy API key (optionally a gaspolicyId). - Send calls with
eip7702Auth: true(and optionalpaymasterService.policyId).
When using the SmartWalletClient you must set the eip7702Auth capability to true: