EOA Execution Mode

The EOA (Externally Owned Account) execution mode enables standard Ethereum wallets to execute complex multi-chain operations through the Supertransaction API. This mode bridges traditional wallets with advanced orchestration capabilities.

Execution Flow

The EOA execution flow consists of three main phases:

1. Token Approval

Before orchestration, the EOA must approve the Orchestrator smart account to spend its tokens. The API automatically determines the optimal approval method based on the tokens in your fundingTokens array.

2. Orchestration

The Orchestrator smart account executes all operations across multiple chains as defined in your instructions.

3. Fund Return

After successful execution, any remaining funds are automatically returned to your EOA.

Approval Methods

The API intelligently selects between two approval mechanisms based on token capabilities:
{
  "type": "permit",
  "signablePayload": {
    "domain": {
      "name": "USD Coin",
      "version": "2",
      "chainId": 1,
      "verifyingContract": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
    },
    "types": {
      "Permit": [
        {"name": "owner", "type": "address"},
        {"name": "spender", "type": "address"},
        {"name": "value", "type": "uint256"},
        {"name": "nonce", "type": "uint256"},
        {"name": "deadline", "type": "uint256"}
      ]
    },
    "message": {
      "owner": "0x742d35C9a91B1D5b5D24Dc30e8F0dF8E84b5d1c4",
      "spender": "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45",
      "value": "1000000000",
      "nonce": "0",
      "deadline": "1710003600"
    }
  }
}
ERC20 Permit is preferred when available as it requires no gas for approval. The API falls back to standard approve transactions for tokens that don’t support EIP-2612.

Implementation Steps

Step 0: Prepare Instructions

Use the /compose endpoint to build your transaction workflow by combining different operation types:
const instructions = await fetch('/v1/instructions/compose', {
  method: 'POST',
  body: JSON.stringify([
    {
      type: "/instructions/intent-simple",
      data: {
        srcToken: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
        dstToken: "0x4200000000000000000000000000000000000006",
        srcChainId: 1,
        dstChainId: 8453,
        fromAddress: "0x742d35cc6639cb8d4b5d1c5d7b8b5e2e7c0c7a8a",
        amount: "1000000000",
        mode: "eoa",
        slippage: 0.01
      }
    }
  ])
});
The compose endpoint returns MEE instructions that define your complete workflow. You can combine intent, intent-simple, and build operations in a single composition.

Step 1: Generate Quote

Request a quote with type: "eoa" and your desired operations:
const quoteRequest = {
  type: "eoa",
  fromAddress: "0x742d35C9a91B1D5b5D24Dc30e8F0dF8E84b5d1c4",
  fundingTokens: [
    {
      tokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
      chainId: 1,
      amount: "1000000000"
    }
  ],
  instructions: [
    // Your MEE instructions
  ]
};

const quoteResponse = await fetch('/v1/mee/quote', {
  method: 'POST',
  body: JSON.stringify(quoteRequest)
});

Step 2: Sign Payloads

The response includes payloadToSign array with objects requiring signatures:
const { payloadToSign, quoteType } = quoteResponse;

const signatures = await Promise.all(
  payloadToSign.map(async (payload) => {
    if (quoteType === 'permit') {
      // Sign EIP-712 typed data
      return await wallet.signTypedData(payload.signablePayload);
    } else if (quoteType === 'onchain') {
      // Sign and send approval transaction
      const tx = await wallet.sendTransaction(payload);
      await tx.wait();
      return tx.hash;
    }
  })
);

Step 3: Execute Quote

Submit the signed quote for execution:
const executeRequest = {
  ...quoteResponse,
  payloadToSign: payloadToSign.map((payload, index) => ({
    ...payload,
    signature: signatures[index]
  }))
};

const executeResponse = await fetch('/v1/mee/execute', {
  method: 'POST',
  body: JSON.stringify(executeRequest)
});

const { supertxHash } = executeResponse;

Token Support

The API automatically detects token capabilities:
Token TypeApproval MethodGas Required
EIP-2612 CompatibleERC20 PermitNo
Standard ERC20Approve TransactionYes
Native TokensDirect TransferNo

Response Structure

The payloadToSign array returns different structures based on the approval method:
{
  "quoteType": "permit",
  "payloadToSign": [
    {
      "signablePayload": {
        "domain": {...},
        "types": {...},
        "message": {...},
        "primaryType": "Permit"
      },
      "metadata": {
        "nonce": "0",
        "owner": "0x742d35C9...",
        "spender": "0x68b34658...",
        "amount": "1000000000"
      }
    }
  ]
}

Security Considerations

Always verify the spender address in approval requests matches the official Orchestrator smart account address for your environment.
  • Approval Amounts: The API requests approval for exact amounts needed
  • Time Bounds: Quotes include upperBoundTimestamp for expiration
  • Signature Validation: All signatures are verified before execution
  • Fund Safety: Remaining funds are automatically returned to the EOA

Example: Cross-Chain Swap

Complete example swapping USDC on Ethereum to WETH on Base:
async function crossChainSwap() {
  // 1. Generate quote
  const quote = await generateQuote({
    type: "eoa",
    fromAddress: userWallet.address,
    fundingTokens: [{
      tokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
      chainId: 1,
      amount: "1000000000" // 1000 USDC
    }],
    instructions: [
      // Cross-chain swap instructions
    ]
  });

  // 2. Sign approvals
  const signedPayloads = await signApprovals(quote.payloadToSign);

  // 3. Execute
  const result = await executeQuote({
    ...quote,
    payloadToSign: signedPayloads
  });

  console.log(`Transaction hash: ${result.supertxHash}`);
}