Prerequisites
Before testing, ensure you have:- The
parser_clibinary built (see installation instructions) - A raw transaction hex from your DApp or protocol
- The expected output you want to verify
Quick testing workflow
1. Parse your transaction
Run the parser CLI with your transaction:2. Verify the output
Check that the visualization:- Shows the correct action (swap, transfer, approval, etc.)
- Displays accurate amounts and addresses
- Uses appropriate labels that users will understand
3. Test the condensed view
Hardware wallets have limited screen space. Verify your visualization works in condensed mode:4. Check JSON output
For programmatic validation, use JSON output:jq:
Common issues
Transaction fails to parse
Cause: Incorrect chain type or malformed hex encoding. Solution: Verify the chain flag matches your transaction and that the hex is properly formatted (with or without0x prefix, depending on chain conventions).
Missing protocol details
Cause: The parser does not recognize your contract or protocol. Solution: You may need to add a protocol-specific preset. See Creating Visualizations for patterns.Output too verbose for hardware wallets
Cause: The condensed view includes too many fields. Solution: Review your visualization’sCondensed section in the PreviewLayout and reduce it to only the essential fields.
Amounts display incorrectly
Cause: Decimal handling or token metadata issues. Solution: Verify that token decimals are correctly applied. Use theamount_v2 field type with proper Amount and Abbreviation values.
Adding test fixtures
When your visualization is working, add a test fixture to ensure it does not regress.1. Save your transaction
Create a fixture file in the appropriate chain directory:my_protocol_swap.input.
2. Add expected output
Create a corresponding expected output file with the same name but.expected extension. This captures the correct JSON output for comparison.
3. Write a test
Add a test that compares the parser output against your expected fixture:4. Run tests
Verify your fixture passes:Validation checklist
Before submitting your visualization:- Parses correctly with
--output human - Condensed view shows critical information only
- Amounts and addresses are accurate
- Labels are clear to non-technical users
- Test fixture added and passing
Related documentation
- Parser CLI Development - Full CLI reference and examples
- Creating Visualizations - Design patterns for visualizations
- Field Types Reference - Available field types and their usage