eip-5792
Add EIP-5792 batched transaction support to a Scaffold-ETH 2 project. Use when the user wants to: batch multiple contract calls, use wallet_sendCalls, add EIP-5792 wallet integration, batch onchain transactions, or use wagmi's experimental batch hooks.
- License 许可
- MIT
- 最近更新
- 2026-10-01
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- eip-5792
- description
- Add EIP-5792 batched transaction support to a Scaffold-ETH 2 project. Use when the user wants to: batch multiple contract calls, use wallet_sendCalls, add EIP-5792 wallet integration, batch onchain transactions, or use wagmi's experimental batch hooks.
03 SKILL.md 正文
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
04 同仓库更多 Skills
x402
Add x402 payment-gated routes to a Scaffold-ETH 2 project. Use when the user wants to: monetize an API with micropayments, add HTTP 402 payment required to routes, gate content behind crypto payments, implement pay-per-call APIs, or integrate the x402 protocol.
why-ethereum
Why build on Ethereum specifically. The AI agent angle — ERC-8004, x402, composability, permissionless deployment. Use when a user asks "should I build on Ethereum?", "why blockchain?", or when an agent needs to recommend a chain for a project.
wallets
How to create, manage, and use Ethereum wallets. Covers EOAs, smart contract wallets, multisig (Safe), and account abstraction. Use this skill whenever you are sending transactions, signing messages, or managing funds. Includes guardrails for safe key handling.
tools
Current Ethereum development tools, frameworks, libraries, RPCs, and block explorers. What actually works today for building on Ethereum. Includes tool discovery for AI agents — MCPs, abi.ninja, Foundry, Scaffold-ETH 2, Hardhat, and more. Use when setting up a dev environment, choosing tools, or when an agent needs to discover what's available.
testing
Smart contract testing with Foundry — unit tests, fuzz testing, fork testing, invariant testing. Use when writing tests for a smart contract.
subgraph
Integrate The Graph subgraph into a Scaffold-ETH 2 project for indexing blockchain events. Use when the user wants to: index contract events with The Graph, add a subgraph, query onchain data with GraphQL, set up a local graph node, or deploy a subgraph to Subgraph Studio.