Skip to content

Add simulate-before-send pattern to all skill examples#5

Merged
critesjosh merged 1 commit intomainfrom
simulate-before-send
Mar 2, 2026
Merged

Add simulate-before-send pattern to all skill examples#5
critesjosh merged 1 commit intomainfrom
simulate-before-send

Conversation

@critesjosh
Copy link
Owner

Summary

  • Add .simulate() before every .send() call across all 15 TypeScript skill files (~60 instances)
  • Document the pattern in CLAUDE.md as a critical section
  • Without simulation, failing transactions hang for up to 600s with opaque errors; .simulate() surfaces revert reasons instantly

Transformation rules applied

Rule Pattern Files affected
Standard sends Add .simulate({ from }) before .send() All 15 files
Deploy chains Break .deploy().send() → variable, simulate, send 8 files
Account deploys Break getDeployMethod().send() → variable, simulate, send 7 files
Error tests Replace .send() with .simulate() entirely test-patterns.md
Helper functions Add .simulate() inside before .send() 3 files
Parallel sends Simulate all upfront, then send in parallel transaction-patterns.md
AuthWit Simulate without authWitnesses (only from) authwit-frontend.md

Key constraints followed

  • .simulate() only uses { from } — no fee, wait, or authWitnesses
  • "Common Errors" examples in authwit-frontend.md intentionally left unmodified
  • Variable naming: deployRequest for contract deploys, deployMethod for account deploys

Motivation

Since this plugin is referenced by the Aztec MCP server, these examples directly influence how AI agents write Aztec code. Ref: aztec-starter#245

Test plan

  • grep -r '\.deploy(.*).send(' skills/ returns 0 results (all deploy chains broken)
  • grep -r 'getDeployMethod()).send(' skills/ returns 0 results (all inline chains broken)
  • No .simulate() calls include fee, wait, or authWitnesses params
  • Error examples in authwit-frontend.md (lines 120-157) unchanged
  • All error test patterns use .simulate() instead of .send()

🤖 Generated with Claude Code

Without .simulate() before .send(), failing Aztec transactions hang
for up to 600s with opaque errors. .simulate() surfaces revert reasons
instantly. This adds the pattern to all ~60 .send() calls across 15
skill files plus documents it in CLAUDE.md.

Transformation rules applied:
- Standard sends: add .simulate({ from }) before .send()
- Deploy chains: break .deploy().send() into variable, simulate, send
- Account deploys: break getDeployMethod().send() chains similarly
- Error tests: replace .send() with .simulate() entirely
- Helper functions: add .simulate() inside before .send()
- Parallel sends: simulate all upfront, then send in parallel
- AuthWit: simulate without authWitnesses (only from)

Refs: AztecProtocol/aztec-starter#245
@critesjosh critesjosh merged commit 7bcfbcf into main Mar 2, 2026
@critesjosh critesjosh deleted the simulate-before-send branch March 2, 2026 18:35
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