feat: submit agent-wallet transactions from Python#122
Conversation
Time Submission Status
Submit or update total time with: Add time on top of previous submission with: See available commands to help comply with our Guidelines. |
|
Warning Review limit reached
More reviews will be available in 43 minutes and 2 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds ChangesMAA Execute Agent Action
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 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)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@src/trufnetwork_sdk_py/client.py`:
- Around line 3657-3660: The json.dumps call at line 3658 allows NaN and
Infinity values which serialize to invalid JSON that Go decoders reject
downstream. Add the allow_nan=False parameter to the json.dumps call to reject
non-finite floats early at the Python layer with validation. Additionally, when
allow_nan=False is set, json.dumps raises ValueError (not just TypeError) for
non-finite float values, so update the except clause to catch both TypeError and
ValueError exceptions and ensure the error message appropriately describes JSON
serialization failures.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: a0834810-b9c3-4ca8-bfde-5949d141e56e
⛔ Files ignored due to path filters (1)
go.sumis excluded by!**/*.sum
📒 Files selected for processing (4)
bindings/maa.gogo.modsrc/trufnetwork_sdk_py/client.pytests/test_maa_exec.py
|
@holdex pr submit-time 4h |
resolves: https://github.com/truflation/website/issues/4085
A Python app can already set up and observe an agent wallet (derive, create the rule, join/fund, read back). It still cannot make the agent act. This adds
TNClient.execute_agent_action, so a delegated restricted key can run its allow-listed actions as the wallet and the unrestricted owner can withdraw — closing the operate-the-agent half of the MAA lifecycle for Python.ExecuteAgentAction(no new protocol logic); inner-action args cross the boundary as JSON decoded withUseNumber(), the existing action-args convention.maa_execsubmission path.Builds on:
Summary by CodeRabbit
New Features
execute_agent_actionmethod enables executing allow-listed inner actions on behalf of agent wallets with automatic address validation and JSON serialization.Tests
Chores