Skip to content

feat: deploy EVM smart account with cheapest tx in react-wagmi#209

Open
rtomas wants to merge 4 commits into
mainfrom
rtomas/cheapest-evm-deploy-tx
Open

feat: deploy EVM smart account with cheapest tx in react-wagmi#209
rtomas wants to merge 4 commits into
mainfrom
rtomas/cheapest-evm-deploy-tx

Conversation

@rtomas

@rtomas rtomas commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Adds a flow to the react/react-wagmi example for a connected EVM smart-account user to deploy their account on-chain. A smart account (ERC-4337) is only deployed on its first transaction, so the new SmartAccountDeployButton triggers deployment with the cheapest possible tx — a 0-value self-transfer. It detects whether the account is already deployed via useBytecode and shows the button only when the account type is smartAccount and not yet deployed. App.tsx now sets defaultAccountTypes: { eip155: 'smartAccount' } so the embedded wallet uses a smart account on EVM by default.

🤖 Generated with Claude Code

Add a SmartAccountDeployButton that lets a connected EVM smart-account
user deploy their account on-chain via a 0-value self-transfer (the
cheapest tx that triggers ERC-4337 deployment). Detect deployment status
via bytecode and enable smart accounts by default for eip155.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
appkit-web-examples-javascript-bitcoin Ready Ready Preview, Comment Jun 23, 2026 7:01pm
appkit-web-examples-javascript-ethers Ready Ready Preview, Comment Jun 23, 2026 7:01pm
appkit-web-examples-javascript-solana Ready Ready Preview, Comment Jun 23, 2026 7:01pm
appkit-web-examples-javascript-wagmi Ready Ready Preview, Comment Jun 23, 2026 7:01pm
appkit-web-examples-next-bitcoin Ready Ready Preview, Comment Jun 23, 2026 7:01pm
appkit-web-examples-next-ethers Ready Ready Preview, Comment Jun 23, 2026 7:01pm
appkit-web-examples-next-multichain Ready Ready Preview, Comment Jun 23, 2026 7:01pm
appkit-web-examples-next-solana Ready Ready Preview, Comment Jun 23, 2026 7:01pm
appkit-web-examples-next-wagmi Ready Ready Preview, Comment Jun 23, 2026 7:01pm
appkit-web-examples-react-bitcoin Ready Ready Preview, Comment Jun 23, 2026 7:01pm
appkit-web-examples-react-core-up Ready Ready Preview, Comment Jun 23, 2026 7:01pm
appkit-web-examples-react-ethers Ready Ready Preview, Comment Jun 23, 2026 7:01pm
appkit-web-examples-react-ethers5 Ready Ready Preview, Comment Jun 23, 2026 7:01pm
appkit-web-examples-react-multichain Ready Ready Preview, Comment Jun 23, 2026 7:01pm
appkit-web-examples-react-solana Ready Ready Preview, Comment Jun 23, 2026 7:01pm
appkit-web-examples-react-wagmi Building Building Preview, Comment Jun 23, 2026 7:01pm
appkit-web-examples-vue-bitcoin Canceled Canceled Jun 23, 2026 7:01pm
appkit-web-examples-vue-ethers Ready Ready Preview, Comment Jun 23, 2026 7:01pm
appkit-web-examples-vue-multichain Ready Ready Preview, Comment Jun 23, 2026 7:01pm
appkit-web-examples-vue-solana Ready Ready Preview, Comment Jun 23, 2026 7:01pm
appkit-web-examples-vue-wagmi Ready Ready Preview, Comment Jun 23, 2026 7:01pm
react-core-universal-connector Ready Ready Preview, Comment Jun 23, 2026 7:01pm

Request Review

@claude

claude Bot commented Jun 8, 2026

Copy link
Copy Markdown

Claude finished @rtomas's task in 1m 43s —— View job


Code Review

  • Gather context
  • Read changed files
  • Run breaking changes subagent — no issues
  • Run data classification subagent — no issues
  • Post review findings
Found 2 issue(s)

Issue 1: Deploy button enabled while bytecode check is loading

ID: smartaccountdeploybutton-button-enabled-loading-a3f1
File: react/react-wagmi/src/components/SmartAccountDeployButton.tsx:71
Severity: MEDIUM
Category: code_quality

Context:

  • Pattern: disabled={isPending || isConfirming} omits isCheckingDeployment, so the "Deploy" button is active while useBytecode is still resolving
  • Risk: isDeployed is false while bytecode is undefined (loading), so the "not deployed yet" section and deploy button render during the loading window
  • Impact: A user can click "Deploy" before the contract status is known, potentially submitting a redundant transaction when the account is already deployed
  • Trigger: Any page load or network switch where bytecode hasn't resolved yet

Recommendation:

<button onClick={handleDeploy} disabled={isPending || isConfirming || isCheckingDeployment}>

Issue 2: useBytecode error state not surfaced

ID: smartaccountdeploybutton-bytecode-error-unhandled-b2c4
File: react/react-wagmi/src/components/SmartAccountDeployButton.tsx:21
Severity: LOW
Category: code_quality

Context:

  • Pattern: useBytecode is destructured without an error field; if the RPC call fails the component silently shows "not deployed" with the deploy button enabled
  • Risk: Network or RPC errors silently misrepresent account state as undeployed
  • Impact: User may attempt to deploy an already-deployed account or be confused by the missing status
  • Trigger: RPC failures, rate-limiting, or unsupported chains

Recommendation:

const { data: bytecode, isLoading: isCheckingDeployment, error: bytecodeError, refetch: refetchBytecode } =
  useBytecode({ ... })

// In JSX, below the existing error display:
{bytecodeError && (
  <pre>Error checking deployment status: {bytecodeError.message}</pre>
)}

Comment thread react/react-wagmi/src/components/SmartAccountDeployButton.tsx
Comment thread react/react-wagmi/src/components/SmartAccountDeployButton.tsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant