Skip to content

Conversation

@adamegyed
Copy link
Collaborator

@adamegyed adamegyed commented Nov 18, 2025

Pull Request Checklist


PR-Codex overview

This PR focuses on enhancing the encoding and decoding functionality for transactions in the smart-accounts package, particularly for light accounts and modular accounts. It introduces new utility functions and modifies existing ones to support better handling of calls.

Detailed summary

  • Added LightAccountAbi type to define account ABI based on type and version.
  • Introduced encodeCallsLA and decodeCallsLA functions for handling light account calls.
  • Refactored encodeCalls and decodeCalls methods in base.ts to utilize new utilities.
  • Enhanced error handling for self-calls in encodeCalls for modular accounts.
  • Updated tests to validate encoding and decoding for both single and batch transactions.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

@vercel
Copy link

vercel bot commented Nov 18, 2025

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

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
aa-sdk-ui-demo Ignored Ignored Preview Nov 18, 2025 10:21pm

@github-actions
Copy link

github-actions bot commented Nov 18, 2025

🌿 Documentation Preview

Name Status Preview Updated (UTC)
Alchemy Docs ✅ Ready 🔗 Visit Preview Nov 18, 2025, 10:22 PM

@github-actions github-actions bot temporarily deployed to docs-preview November 18, 2025 20:14 Inactive
@github-actions github-actions bot temporarily deployed to docs-preview November 18, 2025 20:15 Inactive
@adamegyed adamegyed marked this pull request as ready for review November 18, 2025 20:32
Copilot AI review requested due to automatic review settings November 18, 2025 20:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds encoding and decoding functionality for transaction calls in both Light Account (LA) and Modular Account v2 (MAv2) implementations. The changes enable proper serialization and deserialization of single and batch transaction data.

Key Changes

  • Introduced decodeCalls method for both LA and MAv2 accounts to reverse the encoding process
  • Refactored LA encoding logic into separate utility functions (encodeCallsLA and decodeCallsLA)
  • Added special handling for MAv2 self-calls to avoid double-wrapping
  • Added comprehensive tests for encoding/decoding single and batch transactions

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/smart-accounts/src/ma-v2/accounts/base.ts Added decodeCalls method and self-call handling in encodeCalls
packages/smart-accounts/src/ma-v2/accounts/account.test.ts Added tests for encoding/decoding single and batch transactions
packages/smart-accounts/src/light-account/registry.ts Added LightAccountAbi type helper for ABI type inference
packages/smart-accounts/src/light-account/accounts/calldataCodec.ts New file with LA-specific encoding/decoding utilities
packages/smart-accounts/src/light-account/accounts/base.ts Refactored to use new encoding/decoding utility functions
packages/smart-accounts/src/light-account/accounts/account.test.ts Added tests for encoding/decoding single and batch transactions
docs-site Updated subproject commit reference

@github-actions github-actions bot temporarily deployed to docs-preview November 18, 2025 21:56 Inactive
@github-actions github-actions bot temporarily deployed to docs-preview November 18, 2025 21:56 Inactive
@github-actions github-actions bot temporarily deployed to docs-preview November 18, 2025 22:21 Inactive
@github-actions github-actions bot temporarily deployed to docs-preview November 18, 2025 22:21 Inactive

expect(decoded.length).toEqual(data.length);
expect(decoded[0].to.toLowerCase()).toEqual(data[0].to.toLowerCase());
expect(decoded[0].value);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incomplete test assertion. The line expect(decoded[0].value); is checking for truthiness but lacks a matcher (like .toBe(0n) or .toBeDefined()). This test will always pass regardless of the actual value. Based on the encoding logic in calldataCodec.ts line 17 which always provides a value (calls[0].value ?? 0n), and the decoding logic on line 50 which includes the value when defined, this should be:

expect(decoded[0].value).toBe(0n);
Suggested change
expect(decoded[0].value);
expect(decoded[0].value).toBe(0n);

Spotted by Graphite Agent

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

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