fix: use sendCalls for smart wallets without traditional wallet client#271
fix: use sendCalls for smart wallets without traditional wallet client#271
Conversation
…lient Base Account (Coinbase Smart Wallet) uses EIP-5792 wallet_sendCalls instead of eth_sendTransaction, so useWalletClient() returns undefined. The @base-org/account SDK also doesn't properly populate wallet_getCapabilities, causing isBatchSupported to be false. This resulted in a "Wallet not connected" error on transaction submission. Fall back to sendCallsSyncAsync whenever walletClient is absent, since EIP-5792 wallets support wallet_sendCalls for both single and batched transactions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
✅ Approved
Score: ███████░░░ 7/10
Small, targeted fix for smart wallets that lack a traditional walletClient (e.g. account-abstraction wallets). The core logic is sound: when there's no walletClient, route through sendCallsSyncAsync instead of trying to call walletClient.sendTransaction, which would fail.
Two things worth noting:
-
isBatchSupportedis now semantically overloaded — it'struewhen there's no wallet client, not just when atomic batching is supported. This works in practice for all current consumers but will confuse future readers. -
The removal of the
calls.length > 1guard is an unrelated behavioral change: even EOA wallets with batch support now usesendCallsfor single transactions. Probably fine, but it wasn't called out in the PR description.
📌 2 inline comments
🔍 Reviewed by Gaston · Model: claude-opus-4-6
|
|
||
| const isBatchSupported = !!capabilities?.[chainId]?.atomicBatch?.supported; | ||
| const isBatchSupported = | ||
| !!capabilities?.[chainId]?.atomicBatch?.supported || !walletClient; |
There was a problem hiding this comment.
Semantic concern: isBatchSupported now means "batch is supported OR there's no wallet client." This variable is exported and consumed by ~10 UI components to decide whether to show sequential-transaction warnings (!isBatchSupported && calls.length > 1). It happens to work correctly — smart wallets without a walletClient won't show the warning — but the name no longer describes what it computes. Consider renaming to useSendCalls or splitting into two flags to keep intent clear.
| let receipts: TransactionReceipt[]; | ||
|
|
||
| if (isBatchSupported && calls.length > 1) { | ||
| if (isBatchSupported || !walletClient) { |
There was a problem hiding this comment.
The calls.length > 1 guard was removed. Previously, EOA wallets with batch support still used sendTransaction for single calls; now they go through sendCallsSyncAsync for everything. This is a behavioral change beyond the stated fix. Likely harmless (sendCalls with one call should work fine), but worth confirming this was intentional and not an accidental side effect.
Summary
useWalletClient()returnsundefinedfor EIP-5792 wallets anduseCapabilities()returns empty capabilities due to a gap in@base-org/account@2.4.0sendCallsSyncAsync(EIP-5792wallet_sendCalls) wheneverwalletClientis absent, fixing both single and batched transactions for smart walletsTest plan
🤖 Generated with Claude Code