fix/batches-result#196
Conversation
WalkthroughThe PR refactors return payloads in batch estimation and sending methods to return result objects directly instead of merging them with internal kit state, updates corresponding test assertions to reflect the new behavior, and bumps the version to 2.1.3. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ 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: 0
🧹 Nitpick comments (3)
lib/TransactionKit.ts (1)
4214-4219: sendBatches now returns only result at function end.Consistent payload and easier typing for consumers; nice cleanup.
For consistency, consider aligning single-tx estimate()/send() to also return plain results (no
...this) in a follow-up patch to avoid differing shapes across APIs.__tests__/EtherspotTransactionKit.test.ts (2)
964-967: Assert on nested batch transactions length.Good update matching new
result.batches[batchName].transactionsshape.Optionally also assert
result.batches['batch1'].chainGroupsexists to cover group aggregation.
977-982: Explicit error entry for non-existent batch.Solid: verifies presence of error metadata and failure flag for missing batch.
Add
expect(result.batches['doesnotexist'].transactions).toHaveLength(0)and, if available,expect(result.batches['doesnotexist'].errorType).toBe('VALIDATION_ERROR')for completeness.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (4)
CHANGELOG.md(1 hunks)__tests__/EtherspotTransactionKit.test.ts(2 hunks)lib/TransactionKit.ts(4 hunks)package.json(1 hunks)
🔇 Additional comments (6)
package.json (1)
4-4: Version bump acknowledged (2.1.3).Looks good for a patch release tied to batch result shape fixes. Ensure CHANGELOG and tag align on publish.
lib/TransactionKit.ts (3)
2344-2347: Empty-batches early return now returns a plain result object.Good: prevents leaking instance state in batch API. Matches stated behavior change.
3061-3066: Modular estimateBatches final return simplified to result.Aligns modular and delegatedEoa branches; clearer contract for callers.
2755-2760: Batch methods correctly return only result; no API surface mixing detected.Verification confirms estimateBatches and sendBatches methods return only
resultwithout spreadingthis. All 13 matches of{ ...result, ...this }found in the codebase occur in non-batchestimate()andsend()methods (lines 1099, 1124, 1167, 1458, 1559, 1653, 1679, 1723, 2042, 2231), which are before line 2289 where estimateBatches begins. The batch methods maintain clean API boundaries as intended.CHANGELOG.md (2)
3-7: Verify release date for version 2.1.3.The changelog entry is clear and accurately describes the fix to
sendBatches()andestimateBatches()return values. However, the date2025-01-27matches versions 2.1.2, 2.1.1, and 2.1.0 below it, which is unusual for sequential patch/minor releases. Typically, each release has its own date reflecting when it was published.Confirm whether version 2.1.3 was released on the same date as the previous versions or if the date should be updated to reflect the actual release date.
3-7: Changelog entry is clear and well-structured.The entry effectively communicates what was fixed: the return values of
sendBatches()andestimateBatches()now correctly includechainGroupsanduserOpHashdata. The description aligns with the PR objectives and maintains consistency with the existing changelog format.
Description
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Summary by CodeRabbit