Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.startale.com/llms.txt

Use this file to discover all available pages before exploring further.

EIP-7702 lets an existing EOA delegate execution to a smart contract while keeping the same address. Combined with the Startale Smart Account, that means you can take any EOA and start sending UserOperations from it without migrating funds, rotating keys, or asking the user to remember a new address.

What EIP-7702 does, in one diagram

The address is unchanged. What changes is the code at that address: a 23-byte delegation indicator (0xef0100 || implementation) that tells the EVM to execute the implementation’s code whenever the address is called. To revert, the user signs a new authorization that points at the zero address.

Why use it

BenefitDetail
No address changeFunds, allowances, and onchain history follow the user.
No deploy stepAuthorization is included in a transaction; the EVM applies the delegation at execution time.
All AA features unlockedSponsored gas, ERC-20 gas, sessions, recovery, and batched calls become available on an EOA.
ReversibleAuthorization for 0x0 clears the delegation.

Prerequisites

  • A signer for the EOA you want to upgrade (private key, wallet client, EIP-1193 provider, or ethers wallet).
  • The Startale account implementationAddress (see Contracts and audits).
  • The bundler and paymaster URLs from the SCS Portal.
npm install @startale-scs/aa-sdk viem
When you pass eip7702Account to toStartaleSmartAccount, the SDK signs the authorization for you on the next UserOperation. This is the cleanest integration: the user signs once, the delegation is applied as part of the same UserOp, and you keep using the same StartaleAccountClient afterwards.
import { http, createPublicClient } from "viem"
import { privateKeyToAccount } from "viem/accounts"
import { soneiumMinato } from "viem/chains"
import {
  createSCSPaymasterClient,
  createSmartAccountClient,
  toStartaleSmartAccount,
} from "@startale-scs/aa-sdk"

const signer = privateKeyToAccount(process.env.OWNER_PRIVATE_KEY as `0x${string}`)
const eoaAddress = signer.address

const publicClient = createPublicClient({ chain: soneiumMinato, transport: http() })

const paymasterClient = createSCSPaymasterClient({
  transport: http(process.env.PAYMASTER_URL!),
})

const smartAccountClient = createSmartAccountClient({
  account: await toStartaleSmartAccount({
    signer,
    chain: soneiumMinato,
    transport: http(),
    accountAddress: eoaAddress,
    eip7702Account: signer,
  }),
  transport: http(process.env.BUNDLER_URL!),
  client: publicClient,
  paymaster: paymasterClient,
  paymasterContext: {
    paymasterId: process.env.PAYMASTER_ID!,
  },
})
SymbolSourceRole
privateKeyToAccountviem/accountsBuilds a viem LocalAccount for the EOA.
accountAddresstoStartaleSmartAccount parameterPins the smart account to the EOA’s address instead of deriving a new counterfactual one.
eip7702AccounttoStartaleSmartAccount parameterWhen set, the SDK uses this signer to sign the EIP-7702 authorization on the next UserOp.
paymasterContext.paymasterIdrequest flagOptional. Sponsoring the upgrade UserOp removes the need for the EOA to hold ETH.

Path B: manual authorization

If you need to inspect or persist the authorization yourself (for example, to store it server-side), sign it explicitly with a viem WalletClient and pass the result as eip7702Auth.
import { createWalletClient, http } from "viem"
import { soneiumMinato } from "viem/chains"
import { toStartaleSmartAccount } from "@startale-scs/aa-sdk"

const walletClient = createWalletClient({
  account: signer,
  chain: soneiumMinato,
  transport: http(),
})

const authorization = await walletClient.signAuthorization({
  contractAddress: process.env.STARTALE_ACCOUNT_IMPLEMENTATION_ADDRESS as `0x${string}`,
})

const account = await toStartaleSmartAccount({
  signer,
  chain: soneiumMinato,
  transport: http(),
  accountAddress: signer.address,
  eip7702Auth: authorization,
})
SymbolSourceRole
walletClient.signAuthorizationviemReturns a SignAuthorizationReturnType over { chainId, address, nonce, ... }.
eip7702AuthtoStartaleSmartAccount parameterA pre-signed authorization to attach to the next UserOp.
Use Path B when you want to:
  • Prepare authorizations server-side and ship them to the client.
  • Sign once with a hardware-backed wallet and reuse the result.
  • Inspect the structure of the authorization before submitting it.

Send a UserOperation

After either path, the client behaves like any other Startale account client:
const hash = await smartAccountClient.sendUserOperation({
  calls: [{ to: target, data: callData, value: 0n }],
})
const receipt = await smartAccountClient.waitForUserOperationReceipt({ hash })
The first UserOp also lands the EIP-7702 delegation; subsequent ones simply use it.

Inspect and revert

The smart account exposes EIP-7702 helpers directly:
const isDelegated = await smartAccountClient.account.isDelegated()

if (isDelegated) {
  const tx = await smartAccountClient.account.unDelegate()
  await publicClient.waitForTransactionReceipt({ hash: tx })
}
MethodSourceRole
account.isDelegated()@startale-scs/aa-sdkReads the EOA’s code and checks for the 0xef0100 prefix.
account.unDelegate()@startale-scs/aa-sdkSubmits an authorization for the zero address, clearing the delegation.

Caveats

Some external wallets restrict EIP-7702 delegation to their own implementation contracts. If your users sign through a wallet that enforces this, you cannot delegate them to the Startale implementation; use a viem LocalAccount or a Privy/Dynamic embedded wallet instead.
  • The authorization is chain-specific unless you set chainId = 0. Use a fresh authorization per chain in normal flows.
  • Delegating bumps the EOA’s nonce, just like any other transaction.
  • Reverting (unDelegate) also bumps the nonce.

Next steps

Smart account setup

Wire the EIP-7702 client into a React provider.

Sponsored paymaster

Sponsor the upgrade UserOp itself.

Smart sessions

Issue session keys for the upgraded EOA.

Contracts and audits

Look up the implementation address per network.