feat(cli): add inspect command for decoded entry values - #299
Conversation
📝 WalkthroughSummary by CodeRabbit
WalkthroughAdds ChangesInspect ScVal Decoding and Non-SAC Support
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 |
|
@Faizehy Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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/commands/inspect.ts`:
- Around line 62-64: The new inactive-key branch in inspect.ts is too late
because inspectContract already prints the synthetic zeroed balance details for
missing balance: entries, resulting in contradictory CLI output. Update the
inspect flow around the item rendering logic so inactive balance keys are
detected before any balance/authorized/clawback fields are printed, and skip the
synthetic balance output entirely when item.found is false or item.status is
unknown. Use the existing inspectContract result handling in inspect.ts to gate
the balance display and keep the inactive-key error message as the only output
for those cases.
In `@src/core/inspect.ts`:
- Around line 359-364: The default branch in `inspect.ts` can return native
values from `scValToNative(scVal)` that include BigInt, which later breaks
`JSON.stringify` in the inspect command. Normalize the value before returning it
from the decoder path in `inspect.ts` by converting any BigInt result to a
string, or otherwise ensure the returned `decodedValue` is JSON-safe. Use the
`scValToNative` call and the `value` assignment in the default case as the place
to apply the fix so `src/commands/inspect.ts` can render it without errors.
🪄 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: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 021fc32e-2aca-4d55-aa5d-291961934911
📒 Files selected for processing (3)
src/commands/inspect.tssrc/core/inspect.tstests/core/inspect.test.ts
📜 Review details
🔇 Additional comments (6)
tests/core/inspect.test.ts (1)
8-8: LGTM!Also applies to: 103-198, 239-239, 313-425
src/core/inspect.ts (5)
16-20: LGTM!Also applies to: 35-35
164-171: LGTM!Also applies to: 181-181
191-197: LGTM!
269-272: LGTM!Also applies to: 281-294
297-307: LGTM!
Co-authored-by: Abdulazeem-code <olamilekanabdulazeem@gmail.com>
Co-authored-by: Abdulazeem-code <olamilekanabdulazeem@gmail.com>
closes #155