Getting Started ยท EIP-5792
Skip to content

Getting Started

For Wallets

To implement support for the new RPC methods, wallets need to:

  1. Implement wallet_getCapabilities to indicate support for atomic execution and other capabilities
  2. Implement wallet_sendCalls to process batches of calls
  3. Implement wallet_getCallsStatus to allow checking the status of submitted calls
  4. Implement wallet_showCallsStatus to display call information to users

wallet_getCapabilities

This method allows wallets to indicate their support for various capabilities, including atomic execution. The atomic capability can have three states:

  • supported: The wallet will execute all calls atomically and contiguously
  • ready: The wallet is able to upgrade to supported pending user approval (e.g. via EIP-7702)
  • unsupported: The wallet does not provide any atomicity or contiguity guarantees

Example response:

{
  "atomic": "supported",
  "paymasterService": {
    "supported": true
  }
}

wallet_sendCalls

This method processes a batch of calls. If atomicRequired field is set to true, the wallet must execute all of the calls atomically, otherwise it may execute them atomically or sequentially.

Example request:

{
  "method": "wallet_sendCalls",
  "params": [
    {
      "version": "2.0.0",
      "chainId": "0x1",
      "from": "0x...",
      "calls": [
        {
          "to": "0x...",
          "data": "0x...",
          "value": "0x0"
        }
      ],
      "capabilities": {
        "atomic": {
          "required": true
        }
      }
    }
  ]
}

Example response:

{
  "id": "0x00000000000000000000000000000000000000000000000000000000000000000e670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331",
  "capabilities": {
    "atomic": {
      "status": "supported"
    }
  }
}

The response includes:

  • id: A unique identifier for the batch of calls (up to 4096 bytes)
  • capabilities: Optional capability-specific metadata from the wallet

wallet_getCallsStatus

This method allows checking the status of submitted calls. The status codes follow these categories:

  • 1xx: Pending states
  • 2xx: Confirmed states
  • 4xx: Offchain failures
  • 5xx: Chain rules failures
CodeDescription
100Batch has been received by the wallet but has not completed execution onchain (pending)
200Batch has been included onchain without reverts, receipts array contains info of all calls (confirmed)
400Batch has not been included onchain and wallet will not retry (offchain failure)
500Batch reverted completely and only changes related to gas charge may have been included onchain (chain rules failure)
600Batch reverted partially and some changes related to batch calls may have been included onchain (partial chain rules failure)

Example response:

{
  "status": 200,
  "receipts": [
    {
      "logs": [],
      "status": "0x1",
      "blockHash": "0x...",
      "blockNumber": "0x...",
      "gasUsed": "0x...",
      "transactionHash": "0x..."
    }
  ]
}

wallet_showCallsStatus

This method displays call information to users. It can be used to show the status of submitted calls, including any errors or confirmations.

Example request:

{
  "method": "wallet_showCallsStatus",
  "params": [
    {
      "chainId": "0x1",
      "calls": [
        {
          "to": "0x...",
          "data": "0x...",
          "value": "0x0"
        }
      ],
      "status": 200,
      "receipts": [
        {
          "logs": [],
          "status": "0x1",
          "blockHash": "0x...",
          "blockNumber": "0x...",
          "gasUsed": "0x...",
          "transactionHash": "0x..."
        }
      ]
    }
  ]
}

For Apps

The easiest way for apps to start using EIP-5792 is to use a library which has implemented support for EIP-5792:

For example, the following fetches the connected wallet's capabilities using wagmi's useCapabilities hook:

App.tsx
import { useCapabilities } from 'wagmi'
 
function App() {
  const { data: capabilities } = useCapabilities() 
{
"0x0": {
"flow-control": {
"supported": true
}
},
"0x1": {
"atomic": true,
"auxiliaryFunds": {
"supported": true
}
}
}
return <div /> }

While not all wallets are EIP-5792 compliant, apps can call wallet_sendCalls, falling back to a legacy method if they encounter an 4200 Unsupported Method error.

See the following example using Viem's sendCalls implementation, falling back to sendTransaction if the connected wallet doesn't support EIP-5792:

executeTransactions.ts
import { createWalletClient, custom, parseEther } from 'viem'
import { mainnet } from 'viem/chains'
 
export const walletClient = createWalletClient({
  chain: mainnet,
  transport: custom(window.ethereum!),
})
 
const [account] = await walletClient.getAddresses()
 
// Define our transaction calls
const calls = [
  {
    to: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045' as const,
    value: parseEther('1')
  },
  {
    data: '0xdeadbeef' as const,
    to: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' as const,
  },
]
 
async function executeTransactions() {
  try {
    const { id } = await walletClient.sendCalls({ 
      account, 
      calls,
      forceAtomic: true // Force atomic execution, sets `atomicRequired`: true
    })
    return id
  } catch (error) {
    // Check for EIP-5792 unsupported method error (code 4200)
    const err = error as { code?: number; message?: string }
    if (err.code === 4200 || (err.message && err.message.includes('Unsupported Method'))) {
      
      const results = []
      for (const call of calls) {
        try {
          const hash = await walletClient.sendTransaction({ account, ...call })
          results.push({ hash, success: true })
        } catch (txError) {
          results.push({ error: txError, success: false })
        }
      }
      
      return results
    }
    
    throw error
  }
}
 
executeTransactions()
  .then(result => console.log('Transaction result:', result))
  .catch(error => console.error('Transaction failed:', error))