Skip to content

Conversation

@iuwqyir
Copy link
Contributor

@iuwqyir iuwqyir commented Apr 22, 2025

TL;DR

Added support for converting big numbers to strings in decoded transaction and log data.

What changed?

  • Added a new utility function ConvertBigNumbersToString that recursively converts *big.Int and big.Int values to strings
  • Updated the Serialize method for DecodedLog to convert big numbers to strings in both indexed and non-indexed parameters
  • Updated the Serialize method for DecodedTransaction to convert big numbers to strings in decoded inputs
  • Removed unused StripPayload function and related helper functions

How to test?

  1. Create a transaction or log that contains big numbers in its decoded data
  2. Call the Serialize method on the decoded transaction or log
  3. Verify that the big numbers are properly converted to strings in the output

Why make this change?

Big numbers in decoded transaction and log data need to be converted to strings to ensure they can be properly serialized to JSON without precision loss. This is especially important for large numbers that exceed the range of standard JSON number types.

Copy link
Contributor Author

iuwqyir commented Apr 22, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@iuwqyir iuwqyir requested review from AmineAfia and catalyst17 April 22, 2025 09:08
@iuwqyir iuwqyir marked this pull request as ready for review April 22, 2025 09:09
@iuwqyir iuwqyir force-pushed the 04-22-convert_decoded_big_numbers_to_strings_in_api_response branch from 49593e8 to e1c3cc1 Compare April 24, 2025 18:00
@iuwqyir iuwqyir merged commit 13fa6ae into main Apr 24, 2025
5 checks passed
@iuwqyir iuwqyir deleted the 04-22-convert_decoded_big_numbers_to_strings_in_api_response branch April 24, 2025 18:00
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.

3 participants