Rhinestone SDK supports smart EOAs (EIP-7702 accounts) out of the box. You can use any compatible account provider for batched transactions, gas sponsorship, custom validators, session keys, and chain abstraction.
Using EIP-7702 features requires viem@2.28.0 or higher.
Not all smart accounts are compatible with EIP-7702. We recommend starting with Nexus.
To turn an EOA into a smart account:
const rhinestoneAccount = await createRhinestoneAccount({
  owners: {
    type: 'ecdsa',
    accounts: [eoaAccount],
  },
  eoa: eoaAccount,
  rhinestoneApiKey,
})
Before making your first transaction, you will need to sign the account initialization calldata and then the EIP-7702 authorization:

Signing the account initialization data

Before making a transaction preparation, you will need to sign the EIP-7702 data with the user’s EOA. This signature is valid cross-chain, so you can cache it.
const eip7702InitSignature = await rhinestoneAccount.signEip7702InitData()

const transactionData = await rhinestoneAccount.prepareTransaction({
  sourceChains: [sourceChain],
  targetChain,
  calls: [
    {
      to: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
      value: 0n,
      data: '0xdeadbeef',
    },
  ],
  tokenRequests: [
    {
      address: 'ETH',
      amount: ethAmount,
    },
  ],
  eip7702InitSignature,
})

Signing the authorization

When sending the transaction, you will need to sign the EIP-7702 authorization:
const signedTansactionData =
  await rhinestoneAccount.signTransaction(transactionData)

const authorizations =
  await rhinestoneAccount.signAuthorizations(signedTansactionData)

const result = await rhinestoneAccount.submitTransaction(
  signedTansactionData,
  authorizations,
)