Skip to content

feat(types): implement NumericString type across the monorepo #4086

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

VolodymyrBg
Copy link

Description

This PR implements the NumericString type across the monorepo, following the pattern established with PrefixedHexString. The NumericString type represents string values that contain only numeric characters, providing better type safety and consistency across the codebase.

Changes

  • Added NumericString to TypeOutput and TypeOutputReturnType in packages/util/src/types.ts
  • Added NumericString handling to the toType function
  • Updated ParamsConfig type in packages/common/src/types.ts to use NumericString
  • Updated SlotString type in packages/evm/src/journal.ts to use NumericString
  • Updated numberToHex function in packages/block/src/helpers.ts to handle NumericString input
  • Added comprehensive tests for NumericString type conversions

Testing

  • Added new test cases in packages/util/test/types.spec.ts to verify NumericString conversions
  • Tests cover conversions from:
    • null/undefined
    • Number
    • BigInt
    • Uint8Array
    • PrefixedHexString

Related Issues

Closes #3659

@holgerd77 holgerd77 requested a review from gabrocheleau May 19, 2025 16:09
@holgerd77
Copy link
Member

Hi hi, sorry, we need to put this on hold 😬. We have problems with our original "strictification" integration with PrefixedHexString - where this issue was derived from respectively these do not work as expected, see the following explanation on this from our chat from @jochem-brouwer:

grafik

So it's likely that we do not want to follow this approach further because it seems to be a dead end eventually.

Thanks for the work and the thought on this though!! Nevertheless really appreciated! If you want to pick up further issues or just as a general advice, it is always good to drop a note before starting, we try but can't keep all issues fully up-to-date, so there is always some risk that some issues are outdated/replaced by other issues/..., stuff like that.

@holgerd77
Copy link
Member

Actually we can nevertheless run the workflows here once.

So - also - if you have ideas or find insights on the above problem, also let us know. We have done some research ourselves though and did not come to a sufficient solution yet.

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.

Implement the NumericString type accross the monorepo
2 participants