eip-5792
EIP-5792 Integration for Scaffold-ETH 2
Prerequisites
Check if ./packages/nextjs/scaffold.config.ts exists directly in the current working directory (do not search subdirectories). If it doesn't exist, this is not a Scaffold-ETH 2 project. Follow the instructions at https://docs.scaffoldeth.io/SKILL.md to scaffold it first. If it exists, continue directly with building.
Overview
EIP-5792 (Wallet Call API) lets apps send batched onchain write calls to wallets via wallet_sendCalls. No new dependencies needed — SE-2 already includes wagmi, which has the EIP-5792 hooks at wagmi/experimental:
useWriteContracts— batch multiple contract calls into one wallet requestuseCapabilities— detect what the connected wallet supports (batching, paymasters, etc.)useShowCallsStatus— ask the wallet to display status of a batch
Import paths are moving.
useCapabilitiesanduseShowCallsStatushave been promoted towagmi(stable).useWriteContractsis still inwagmi/experimentalas of early 2026. Always check the wagmi docs for the current import paths.
Smart Contract
EIP-5792 works with any contract — the point is batching multiple calls into a single wallet interaction. A simple contract with two or more state-changing functions works well for demonstrating batching:
contract BatchExample {
string public greeting = "Hello!";
uint256 public counter = 0;
function setGreeting(string memory _newGreeting) public payable {
greeting = _newGreeting;
}
function incrementCounter() public {
counter += 1;
}
receive() external payable {}
}
Deploy using the project's existing deployment pattern (Hardhat deploy/ or Foundry script/).
EIP-5792 Integration Pattern
Detecting wallet support
Not all wallets support EIP-5792. Use useCapabilities to check before offering batch UI:
import { useCapabilities } from "wagmi/experimental";
import { useAccount } from "wagmi";
const { address, chainId } = useAccount();
const { isSuccess: isEIP5792Wallet, data: walletCapabilities } = useCapabilities({ account: address });
// Check specific capabilities per chain
const isPaymasterSupported = walletCapabilities?.[chainId]?.paymasterService?.supported;
isSuccess being true means the wallet responded to wallet_getCapabilities — i.e., it's EIP-5792 compliant.
Batching contract calls
Use useWriteContracts to send multiple calls in one wallet interaction. Get the contract ABI and address from SE-2's useDeployedContractInfo hook:
import { useWriteContracts } from "wagmi/experimental";
import { useDeployedContractInfo } from "~~/hooks/scaffold-eth";
const { data: deployedContract } = useDeployedContractInfo("YourContract");
const { writeContractsAsync, isPending } = useWriteContracts();
// Batch two calls
const result = await writeContractsAsync({
contracts: [
{
address: deployedContract.address,
abi: deployedContract.abi,
functionName: "setGreeting",
args: ["Hello from batch!"],
},
{
address: deployedContract.address,
abi: deployedContract.abi,
functionName: "incrementCounter",
},
],
// Optional: add paymaster capability if supported by the wallet
capabilities: isPaymasterSupported ? {
paymasterService: { url: paymasterURL }
} : undefined,
});
Showing batch status
import { useShowCallsStatus } from "wagmi/experimental";
const { showCallsStatusAsync } = useShowCallsStatus();
await showCallsStatusAsync({ id: batchId });
Wallet Compatibility & Graceful Fallback
Graceful degradation is critical. The UI must work for both EIP-5792 and non-EIP-5792 wallets:
- Use SE-2's
useScaffoldWriteContractfor individual calls as fallback - Only show/enable the batch button when
useCapabilitiessucceeds (isEIP5792Wallet) - Consider a "switch to Coinbase Wallet" prompt for unsupported wallets
Capabilities vary by chain. Always check walletCapabilities?.[chainId] for the specific chain, not just whether the wallet is EIP-5792 compliant in general.
SE-2's burner wallet supports EIP-5792 with sequential (non-atomic) calls. Advanced capabilities like paymasters require a live testnet with a compliant wallet (Coinbase Wallet has the most complete implementation).
Paymaster integration (ERC-7677) is optional. If you want gas sponsorship, you need a paymaster service URL passed as a capability in the writeContracts call. The paymaster service is external to SE-2.
How to Test
- Deploy the contract:
yarn deploy - Start the frontend:
yarn start - For basic batching: use any wallet on localhost (SE-2's burner wallet works)
- For advanced capabilities (paymasters, atomic execution): deploy to a live testnet and connect with an EIP-5792 compliant wallet
More from scaffold-eth/scaffold-eth-2
solidity-security
Master smart contract security best practices to prevent common vulnerabilities and implement secure Solidity patterns. Use when writing smart contracts, auditing existing contracts, or implementing security measures for blockchain applications.
10defi-protocol-templates
Implement DeFi protocols with production-ready templates for staking, AMMs, governance, and lending systems. Use when building decentralized finance applications or smart contract protocols.
10ponder
Integrate Ponder into a Scaffold-ETH 2 project for blockchain event indexing. Use when the user wants to: index contract events, add a blockchain backend, set up GraphQL for onchain data, use Ponder with SE-2, or build an indexer for their dApp.
7erc-20
Add an ERC-20 token contract to a Scaffold-ETH 2 project. Use when the user wants to: create a fungible token, deploy an ERC-20, add token minting, build a token transfer UI, or work with ERC-20 tokens in SE-2.
6erc-721
Add an ERC-721 NFT contract to a Scaffold-ETH 2 project. Use when the user wants to: create an NFT collection, deploy an ERC-721, add NFT minting, build an NFT gallery or transfer UI, or work with non-fungible tokens in SE-2.
5siwe
Add Sign-In with Ethereum (SIWE) authentication to a Scaffold-ETH 2 project. Use when the user wants to: add wallet-based login, implement SIWE, authenticate users with their Ethereum wallet, add session management with wallet signing, build sign-in with Ethereum, or add Web3 authentication.
5