Skip to main content
Sign EIP-7702 authorizations to enable your embedded wallets to gain account abstraction capabilities such as transaction bundling, gas sponsorship, and custom permissions.
EIP-7702 enables externally owned accounts (EOAs) to delegate their execution to smart contract code, allowing EOA wallets to function like smart contract wallets.

Overview

EIP-7702 is a groundbreaking proposal that allows EOA wallets to temporarily delegate their code execution to a smart contract. This enables powerful account abstraction features without requiring users to migrate to new wallet addresses.

Key Benefits

  • Transaction batching: Execute multiple operations in a single transaction
  • Gas sponsorship: Enable gasless transactions for users
  • Custom permissions: Implement spending limits and approval logic
  • Session keys: Allow temporary key access with limited permissions
  • Social recovery: Add recovery mechanisms to EOA wallets
  • Backwards compatibility: EOAs can revert to normal operation anytime

How It Works

  1. User signs an EIP-7702 authorization delegating to a contract
  2. Authorization is included in a transaction
  3. During that transaction, the EOA behaves like the delegated contract
  4. After the transaction, the EOA returns to normal
  5. Authorization can be revoked or updated at any time

React SDK

To sign an EIP-7702 authorization, use the sign7702Authorization method from the useSign7702Authorization hook:

Parameters

string
required
The address of the smart contract whose code the EOA will delegate to. This is typically an account implementation contract from your AA provider.Example:
number
required
The chain ID where the authorization will be used.Example:
number
The nonce for the authorization. If not provided, the current transaction count for the wallet will be used automatically.Example:

Options Object

The second parameter is an optional configuration object:
object
Configuration for the authorization confirmation modal.
Wallet
Specific wallet to use for signing. If not provided, uses the user’s default wallet.

Returns

object
The signed EIP-7702 authorization object.

Complete Examples

Enable Gas Sponsorship

UI Customization

Customize the authorization signing modal:

Hide Modal

Hiding the modal removes the user’s ability to review the authorization before signing. Only use this for trusted operations or after obtaining explicit user consent.

Best Practices

Always verify the contract address before delegating:
Ensure the chain ID matches your target network:
Let MoonKey handle nonces automatically unless you have specific requirements:
Clearly explain what authorization means:
Allow users to revoke authorization:
Provide clear error messages:

Troubleshooting

Common issues:
  • Wrong contract address: Verify the account implementation contract
  • Chain ID mismatch: Ensure authorization chain matches transaction chain
  • Nonce issues: Let MoonKey handle nonce automatically
  • Contract not compatible: Ensure contract supports EIP-7702
Handle cancellations gracefully:
Ensure user is on the correct network:
Validate contract addresses:

EIP-7702 Specification

Official EIP-7702 documentation

Sign Transaction

Sign transactions without broadcasting

Send Transaction

Send transactions to the network

Sign Message

Sign messages for authentication

Next Steps