Add abigen state-changing writes via Wallet (extends #68)#98
Conversation
Completes the comptime contract-bindings surface with writes: - send(self, wallet, comptime name, args) ![32]u8 -- builds the same selector ++ encode(args) calldata as call() (shared encodeCall helper) and submits via Wallet.sendTransaction, returning the tx hash - sendValue(..., value: u256) for payable functions - sendAndWait(..., max_attempts) !TransactionReceipt - naming a view/pure function in send is a @CompileError directing the caller to call() instead 832/832 tests pass on 0.16.0; new integration test exercises a real send against Anvil; docs updated with a write example.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThis PR extends ChangesAbigen write API with wallet integration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
docs/content/docs/abigen.mdx (1)
130-133:⚠️ Potential issue | 🟠 Major | ⚡ Quick winStale limitation text contradicts the new write functionality.
The "Scope and limitations" section still states "Writes are deferred. State-changing calls (which would take a
*Wallet) are a planned follow-up." This is now incorrect, as this PR implements the write surface (send,sendValue,sendAndWait).Update this section to reflect that writes are now supported. For example:
- Remove the "Writes are deferred" bullet entirely, or
- Replace it with a note about what write features are complete (e.g., "State-changing calls via
send,sendValue, andsendAndWaitare supported; see Writing to a contract").🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/content/docs/abigen.mdx` around lines 130 - 133, Update the "Scope and limitations" text to remove the stale claim that "Writes are deferred" and instead state that state-changing calls are supported; specifically edit the section to either delete the bullet or replace it with a short note such as: "State-changing calls via send, sendValue, and sendAndWait are supported; see Writing to a contract." Ensure the updated copy references the implemented methods send, sendValue, and sendAndWait to guide readers to the new write surface.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@docs/content/docs/abigen.mdx`:
- Around line 130-133: Update the "Scope and limitations" text to remove the
stale claim that "Writes are deferred" and instead state that state-changing
calls are supported; specifically edit the section to either delete the bullet
or replace it with a short note such as: "State-changing calls via send,
sendValue, and sendAndWait are supported; see Writing to a contract." Ensure the
updated copy references the implemented methods send, sendValue, and sendAndWait
to guide readers to the new write surface.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: c263648f-20a9-462d-870f-d6bfc556a30a
📒 Files selected for processing (4)
CHANGELOG.mddocs/content/docs/abigen.mdxsrc/abigen.zigtests/integration_tests.zig
Completes the comptime contract-bindings flagship with state-changing writes, so the abigen surface now covers reads + events + writes.
send(self, wallet, comptime name, args) ![32]u8-- builds the sameselector ++ encode(args)calldata ascall(sharedencodeCallhelper) and submits viaWallet.sendTransaction, returning the tx hash.sendValue(..., value: u256)for payable functions.sendAndWait(..., max_attempts) !TransactionReceiptwaits for the receipt.view/purefunction insendis a@compileErrordirecting the caller tocall(you don't broadcast a read).Verification
832/832 tests on 0.16.0, fmt clean, docs build, plus a new Anvil integration test that does a real
send("transfer", ...)and checks the receipt.🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
New Features
send,sendValue, andsendAndWaitsendAndWaitenables transaction receipt pollingDocumentation