Skip to main content
Portal’s iOS SDK provides EVM Account Type management through the portal.evmAccountType API. This enables checking wallet account types and upgrading EOA wallets to EIP-7702 on supported EVM chains.

Overview

The EVM Account Type functionality allows you to:
  • Check wallet status to determine the current account type
  • Upgrade to EIP-7702 to enable ejecting the Portal wallet’s EOA private key

Prerequisites

Before using EVM Account Type operations, ensure you have:

Checking Wallet Status

Use getStatus to check the current account type of your wallet. The response includes both the account status and metadata about the wallet addresses.
Task {
    do {
        let chainId = "eip155:10143" // Monad Testnet

        let response = try await portal.evmAccountType.getStatus(chainId: chainId)

        print("Status: \(response.data.status)")
        print("EOA Address: \(response.metadata.eoaAddress)")

        if let smartContractAddress = response.metadata.smartContractAddress {
            print("Smart Contract Address: \(smartContractAddress)")
        }

        if response.data.status == "EIP_155_EOA" {
            print("Can upgrade to EIP-7702")
        } else if response.data.status == "EIP_7702_EOA" {
            print("Already upgraded")
        } else {
            print("Cannot upgrade")
        }
    } catch {
        print("Failed to get account status: \(error.localizedDescription)")
    }
}
Response (EvmAccountTypeResponse):
  • data.status: One of EIP_155_EOA, SMART_CONTRACT, or EIP_7702_EOA
  • metadata.eoaAddress: The EOA address associated with the wallet
  • metadata.smartContractAddress: Your smart contract wallet address (optional, may be nil for EOA-only accounts)
  • metadata.chainId: The chain identifier

Upgrading to EIP-7702

Use upgradeTo7702 to upgrade an EOA wallet to EIP-7702. This method automatically handles the entire upgrade process, including gas subsidization, and returns the transaction hash directly.
Task {
    do {
        let chainId = "eip155:10143" // Monad Testnet

        // Upgrade to EIP-7702
        let txHash = try await portal.evmAccountType.upgradeTo7702(chainId: chainId)
        print("Upgrade done! TX: \(txHash)")

        // Verify final status
        let status = try await portal.evmAccountType.getStatus(chainId: chainId)
        print("Final Status: \(status.data.status)")

        if status.data.status == "EIP_7702_EOA" {
            print("Successfully upgraded to EIP-7702!")
        }
    } catch let error as EvmAccountTypeError {
        switch error {
        case .invalidAccountType(let status):
            print("Cannot upgrade - current status: \(status)")
        case .unsupportedChainNamespace(let chainId):
            print("Unsupported chain ID: \(chainId)")
        default:
            print("Upgrade error: \(error.localizedDescription)")
        }
    } catch {
        print("Upgrade failed: \(error.localizedDescription)")
    }
}
What happens during the upgrade:
  1. Chain validation: Verifies the chain uses the eip155 namespace
  2. Status check: Confirms the wallet is currently an EIP_155_EOA
  3. Authorization building: Creates the EIP-7702 authorization list
  4. Signature: Signs the authorization hash with your wallet
  5. Transaction submission: Submits the subsidized upgrade transaction (gas is paid by Portal)
  6. Transaction hash: Returns the on-chain transaction hash
Response: The method returns a String containing the transaction hash of the submitted upgrade transaction. Error handling: The method throws typed EvmAccountTypeError errors:
  • invalidAccountType(status): The wallet is not an EIP_155_EOA (e.g., already upgraded to EIP_7702_EOA or is a SMART_CONTRACT)
  • unsupportedChainNamespace(chainId): The chain does not use the eip155 namespace
  • portalNotInitialized: The Portal instance is not available
  • invalidSignatureResponse: The signing operation returned an invalid result
  • invalidTransactionResponse: The transaction hash was not returned from the API

The upgrade process is irreversible per wallet. Once upgraded to EIP-7702, the wallet cannot be reverted to a standard EOA on that chain.

Supported Networks

EVM Account Type upgrades are currently available on:
  • Monad Testnet (eip155:10143)
For a complete list of supported chains, reach out to the Portal team.

Next Steps