Overview
EIP-7702 is available as of
[email protected] (web) and @magic-sdk/[email protected] / @magic-sdk/[email protected] (React Native).wallet.sign7702Authorization()— Signs an authorization that delegates your EOA to a smart contract implementationwallet.send7702Transaction()— Sends a Type-4 transaction that includes signed authorizations
Compatibility
- EIP-7702 operates headlessly with no UI confirmation prompt
- Requires a network that supports EIP-7702 (e.g., Ethereum Mainnet, Sepolia, Arbitrum, Base, Optimism)
- The wallet must have ETH (or the network’s native token) to pay for gas
Use Cases
- Temporarily delegate an EOA to a smart contract implementation for advanced features
- Enable batched transactions through a delegated smart account
- Integrate with account abstraction infrastructure that leverages EIP-7702
Usage
Step 1: Sign an EIP-7702 Authorization
Thesign7702Authorization method signs an authorization that delegates your EOA to a specified smart contract. This authorization is then included in a Type-4 transaction.
JavaScript
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
contractAddress | string | Yes | The smart contract implementation address to delegate to |
chainId | number | Yes | The chain ID for the authorization |
nonce | number | No | The account nonce. If omitted, fetched from the network automatically |
Response
| Field | Type | Description |
|---|---|---|
contractAddress | string | The contract address that was authorized |
chainId | number | The chain ID for the authorization |
nonce | number | The nonce used in the authorization |
v | number | The v component of the signature (27 or 28) |
r | string | The r component of the signature |
s | string | The s component of the signature |
Step 2: Send a Type-4 Transaction
Thesend7702Transaction method sends a Type-4 transaction that includes the signed authorization list. This is what actually executes the delegation on-chain.
JavaScript
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
to | string | Yes | The recipient address |
authorizationList | array | Yes | Array of signed authorizations returned by sign7702Authorization |
value | string | No | Value to send in wei (hex string). Defaults to '0x0' |
data | string | No | Transaction calldata. Defaults to '0x' |
gas | string | No | Gas limit (hex string). If omitted, estimated automatically |
gasLimit | string | No | Alias for gas |
maxFeePerGas | string | No | Max fee per gas (hex string). If omitted, fetched from the network |
maxPriorityFeePerGas | string | No | Max priority fee per gas (hex string). If omitted, fetched from the network |
nonce | number | No | Transaction nonce. If omitted, fetched from the network |
Response
| Field | Type | Description |
|---|---|---|
transactionHash | string | The hash of the submitted transaction |
Complete Example
JavaScript